Reputation: 12712
I'm trying to find an easy way to check how many list items are left after a list has been filtered.
I can pick up when the list is being filtered via
$("#theList").listview('option', 'filterCallback', function( text, searchValue ) {
//how many list items are there??
return text.toLowerCase().indexOf( searchValue ) === -1;
});
Is there an easy way to do this? I'm really looking to hook onto a filter applied event if possible. Not having much luck with the docs so any help appreciated.
Upvotes: 2
Views: 1706
Reputation: 2854
You can also check for the presence of class ui-screen-hidden
:
$('#theList li').length - $('#theList .ui-screen-hidden').length
Upvotes: 0
Reputation: 2071
To count the remaining li showing, use the psudo-selector of ":visible" like this...
$("#theList li:visible").length
Upvotes: 2