ScrollView dynamic content

1 Answer 79 Views
General Discussions
Vladislav
Top achievements
Rank 2
Iron
Iron
Vladislav asked on 09 Oct 2023, 11:41 AM
Hello.

I am solving a question with ScrollView. I would need to figure out a way to make the content on the page dynamic. I need the content to be returned from the server, but only when a specific page is displayed. I can't catch the page change event or anything like that.
Can you help me?

Well thank you.

1 Answer, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 10 Oct 2023, 09:24 AM

Hello Vladislav,

The content of the ScrollView is initially loaded and defined by the developer, so you can retrieve the content when initializing the ScrollView. Another possible solution would be to render a custom component for example within the ScrollView and update that component content dynamically based on your exact conditions.

Nevertheless, if further assistance is needed, please share additional information on the exact scenario that you have.

 

Regards,
Konstantin Dikov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!

Vladislav
Top achievements
Rank 2
Iron
Iron
commented on 10 Oct 2023, 10:12 AM

Thank you for your response.

But I don't understand how. How to make a specific condition. My problem is that I need a carousel for many documents / images. But the image data is on the server. I don't want to load everything for the initial initialization, but on demand. And I don't know how to do that when changing the page, only then will I load the data from the server and display it in the custom component. Maybe I'm wrong, but I don't know what event to use to catch the page change. Or how to make a condition so that the custom component is rendered when the page is changed. If I tried it when changing the page / item, the cutom component is no longer rendered. It is rendered on initialization.

Thank you very much.
Konstantin Dikov
Telerik team
commented on 12 Oct 2023, 06:28 AM

Hi Vladislav,

Since there are no events in the ScrollView, you can handle the click event over the ScrollView element and search through the items elements for "aria-hidden" attribute that is "false". You can then use the index of that element to determine which item is currently active and conditionally render its content.

For your convenience, following is an example demonstrating this approach:

Please note that the "click" and "keypress" events are used for handling the change of the current view and the automatic scrolling is disabled.

Vladislav
Top achievements
Rank 2
Iron
Iron
commented on 12 Oct 2023, 02:29 PM

Oh thanks, that sounds good. Thank you very much.
Tags
General Discussions
Asked by
Vladislav
Top achievements
Rank 2
Iron
Iron
Answers by
Konstantin Dikov
Telerik team
Share this question
or