This is incorrect usage. If the button1 is never clicked, then the dataset onReady() never gets executed.
The dataset onReady() should be assigned in the page’s onReady() event handler. Once it runs in the page’s onReady(), the dataset will be ready for all other event handlers and code.
That’s obvious. But this code was meant to run an action on the data on click. And the question is if it’s going work.
In other words, is the dataset.onReady() a single momentary event that triggers once the dataset is ready, and therefore it won’t work if placed inside the onClick function (since it won’t trigger again after the user click the button) or maybe it’s checks for the dataset readiness each time it’s called. (I hope my question is clear).
@jonatandor35 That’s what I was explaining. The code in the button event handler assigns an onReady() to the dataset. That’s all it does. As far as I know, the code inside the dataset’s onReady() does not get executed. Whatever code it is that you want, just put the code in the button event handler.
What about when I want to filter the dataset after the initial page load?? i.e. based on user interaction. I thought onReady() only ever gets called once at page load?
When the page loads it does what I want (which is to create a link for each item in the repeater).
When I change the contents of the repeater (via a dropdown which is connected to a different dataset, which dataset1 filters from) it doesn’t do what I want. Instead it runs the function on the previous contents of the repeater (which I can see in the console log) and doesn’t create the link on the repeater.
I would have thought that this bit of code would wait for the dataset to be ready with the new data, and then fire in the same way as it does when the page loads.