Hi all,
I am using the code below to collapse 3 elements if the dataset returns no results. I expected it to work but it doesn't. Am I overlooking something?
$w.onReady( () => { $w("#dataset4").onReady( () => { let count = $w("#dataset4").getTotalCount(); if (count ===0) { $w("#columnStrip162").collapse(); $w("#columnStrip163").collapse(); $w("#repeater15").collapse(); } else { $w("#columnStrip162").expand(); $w("#columnStrip163").expand(); $w("#repeater15").expand(); }} ); } );
Thanks!
I dont know if this is the problem, but sometimes when you have 0 results the return isn't 0, but undefined or false. try change this if (count ===0) for if (count ===undefined) or if (count ===false)
The code seems to work just fine, can you provide the site URL where the issue is?
Hi!
I just added a repeater and two strips to a page and tested your code on my own site and it worked for me.
Could we get a link to your site and the name of the page in the Editor? Once you provide a link to the site we will be able to have a closer look.
Dara | Corvid Team