export function table1_dataChange(event) {
// This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4
// Add your code for this event here:
$w("#dataset1").onReady( () => {
let count = $w("#dataset1").getTotalCount();
$w("#text10").text = String(count);
} );
}
This one counts the filtered results of my dataset and sends the value to a text box. It only works in Preview mode, not in Live.
@jonatandor35 Thanks but this didn’t do the trick either. Still ok with Preview but no luck inLive.
Here’s the live page (the counter is centered at the bottom of the table, “query returned xxx results”. It should start with the number 450 and then fluctuate based on your choices on the three white dropdowns (year, category, language). https://gemats.wixsite.com/gkmatsaridis/copy-of-law-database-1
You are using the datlaset onReady() incorrectly. It is only to be used when you need to use the dataset as soon as it is ready. Once it is ready, you can no longer use the dataset onReady() event handler as the event already occurred and won’t occur again . The code in table1_dataChange() will never run, since all it is doing is setting the code to run when the dataset is ready. Since the dataset is already ready, the code does not get executed.
Your code should look like this:
export function table1_dataChange(event) {
let count = $w("#dataset1").getTotalCount();
$w("#text10").text = String(count);
}
I’m not saying that this will fix the problem, as you might have other issues in your code. But at least the code should run if the table1_dataChange() event handler is triggered.
Thanks for the explanation. Indeed, as you guessed, your updated code did not fix the problem, suggesting that there are othe “issues in my code”. But again, what issues, other those discussed above, may prevent proper Live display, when the Preview runs perfect?