Chin
Chin

Reputation: 12712

jquerymobile listview events - number of remaining items after filter applied

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

Answers (2)

Pablo
Pablo

Reputation: 2854

You can also check for the presence of class ui-screen-hidden:

$('#theList li').length - $('#theList .ui-screen-hidden').length

Upvotes: 0

sgliser
sgliser

Reputation: 2071

To count the remaining li showing, use the psudo-selector of ":visible" like this...

$("#theList li:visible").length

Upvotes: 2

Related Questions