Best way to run action after list is populated in mobile app.

Best way to run action after list is populated in mobile app.

  

Hi,

We have a mobile app with a native dropdown implemented as a  List and we want to run a js script when the list is fully rendered. If we include JS node with script after assigning values to List variable it doesn't get any values as if the rendered list element were empty. So is there a trick to run an action when the list element is finished populating? Or only way is to have a script running on interval monitoring when list elements counts are equal to the element number in the list variable?


Thank you for any suggestions.


Hi Mykola,

What events are you handling in your screen?

The OnAfterFetch event is called after the data is fetched.

The OnRender event is raised when you render some part of your screen.

Assuming that you get the List from an Screen Aggregate:

To run some logic after the dropdown is rendered on the screen you should use an OnRender event handler. But since the OnRender event is also raised when you are rendering the screen before the values are fetch to populate the dropdown, you should test the Aggregate IsDataFetch property to check if the data is there or not.

Let me know if I was clear or not.

Cheers,

José

Hi José,

The script we want to run is the script that allows search on select element (we have a select with more than 3000 options) so it changes the DOM and triggers OnRender (it is triggered on any DOM manipulation, right?). 

I've managed to achieve correct work if run the script on ready with interval until the count of select options is equal the list length and then run our transform script and clear the interval. 


Solution

Hi Mykola,

If you are changing the DOM yourself with javascript it will not trigger the OnRender.

Why can't you run the transform script after finishing running the other script?

Cheers,

José

Solution