jquerymobile listview events - number of remaining items after filter applied

大城市里の小女人 提交于 2019-12-20 03:21:45

问题


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.


回答1:


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

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




回答2:


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

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


来源:https://stackoverflow.com/questions/7897433/jquerymobile-listview-events-number-of-remaining-items-after-filter-applied

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!