How to Expand & Collapse Panel containing Repeater/Data element

I want to create several Panels in a page, where each of these panels have a repeater and data as part of the container elements. I want to be able to collapse and expand these as the user see fit. When I do that now, when the container is collapsed, and expanded again, the repeater and its data are gone. I am hiding elements, so I guess the problem is that the DOM tree elements are not there anymore. I get errors in the Console also, like:

bundle.js:107 Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'dynamicListItems')
    at bundle.js:107:111
    at onEnter (bundle.js:107:125)

How can I achieve what I want? Do I need to structure my data differently, or is there a way of temporary hiding the data without messing up the DOM?

Hi @Egil_Helland,

We are looking to your question

Regards,
Marina

Hi @Egil_Helland ,

Please, try transferring data to the repeater not through data binding, but by set it using an action “Set Repeater Data to”

Regards,
Oksana

Hi @Oksana_Dmytriieva ,

The problem is not on Page Enter (where I am setting repeater data like shown above), but rather that I want users to be able to click on a panel header after page loads, to then hide/show that panel container with its contents.

So I need some sort of hook into Visibility events or to be able to set on Click events. I have tried both, but I seem unable to set Repeater Data then, for some reason… This is what I try on Click Event (not doing anything based on visibilty or data binding):

assessmentResult is an array that also populates the same way on page load (and that works).

This just leads to console errors when clicked:

Setting repeater data:
bundle.js:30 Proxy(Array) {0: {…}, 1: {…}, 2: {…}, 3: {…}, 4: {…}, 5: {…}, 6: {…}, 7: {…}, 8: {…}, 9: {…}, 10: {…}, 11: {…}, 12: {…}, 13: {…}, Symbol(initedProxy): Proxy(Array)}
sdk.js:16 Uncaught TypeError: Cannot read properties of undefined (reading 'dynamicListItems')

Any ideas? It is like the Repeater Data Container has disappeared…

@Egil_Helland, try to use the Collapsible Panel component from the UI builder components with the suggestion made by @Oksana_Dmytriieva

Regards,
Marina