Scroll to component not working as expected

Good day.

I am struggling with the scroll to component block.

If I close window completely and open again it will work once, sometimes, but I receive the following error.

image

Thereafter it stops working, just repeating the error. Refreshing also does not help, I have to close window completely and reopen.

Any idea as to why this is happening?

I am calling the scroll to component out of a data table “On record selected”, but got the same results when I used a button just for that function.

Here is the code in the data table.

Thank you

Hello @Frans_Fourie

Could you tell me the page where it happens?

Hi @Dima.

NJM container, page is njmInductions.

@Dima

Is it possible to scroll to for example a text field?

I changed it now to a container and it is working fine like that.

Was that my mistake??

Now I watching into it, and as I see you change to scroll to Container, and it works as expected.

I am pretty sure you tried to scroll to a component that doesn’t render yet(not on the scene now). We can’t do that. Please, make sure your component is shown, and only in this case scroll to him.

@Dima

Thank you for the quick response, sorry to be changing things while you are busy.

The component was definitely rendered before trying to scroll, especially when selecting record for second time.

I can try to re create that if you would like? I am not concerned as it is now doing what I need it to do.

Thank you once again for quick and awesome service!!

I can try to re create that if you would like? I am not concerned as it is now doing what I need it to do.

Yes if you can, that would help us to fix it.

Please, make it on an empty page, that help us to faster investigate the problem.

@Dima

I think I have narrowed down the cause for this, and it kind of makes sense to me now.

I have replicated a lot of the code on new page, and struggled to get same results.

The moment I turn on dynamic List for container, and try to scroll to text block inside container I get the error. It makes sense to me because you might have the same text block once or many times, depending on how many items are added dynamically to container, so it doesn`t know to which itteration of same “ID text block” to scroll.

I do believe that to be the cause, please let me know if you agree, because then I have definitely at least learned something today.

If you want to look at it, it NJM container, page is test

That makes sense. Thank you for your efforts.

For now, you could scroll to a container of a text field. But I’ve created a ticket(BKNDLSS-27032) about writing an article for scrolling to the dynamic components.

Let me know if you can’t wait for it, and I create a short cheat sheet for you.

Thanx @Dima.

Scrolling to the container is 100% good enough for me.

I will keep a look out for the article!

Have a good day.

Hello @Frans_Fourie

Here is an article - Scroll to component from dynamic list - Knowledge Base - Backendless Support

Happy coding!