Dataset.getTotalCount is not working

Here is the find button click event and Dataset.getTotalCount always gives the second last result.
I just need to expand the strip when count is greater than 0.

export function btnFindSchedules_click(event) {

findSchedules();
$w ("# dsSchedules "). onReady (() => {
console.log($w( ‘#dsSchedules’ ).getTotalCount().toString());
$w( ‘#stripSchedules’ ).expand();

}

}

You shouldn’t put dataset.onReady() inside an event handler.

  • you didn’t write any condition (I don’t see if else in your code)

Hi
Onready has been removed but I do not need any condition to get total count . When user clicks find button, findSchedules function will add filters to the dataset and get the count. It is such a simple one and taking me ages to solve. Could you pls help ? thanks