Skip to content

Listview with initially hidden items no longer works #4539

row1 opened this Issue Jun 17, 2012 · 3 comments

3 participants

row1 commented Jun 17, 2012

If the items in the list view are initially hidden then they will not get displayed when the user types in the search filter. Items will only start getting displayed when the user presses the backspace key. I would like the list to have no visible items until the user enters a search filter.

This previously worked in jQuery Mobile 1.0:
It no longer works in jQuery Mobile 1.1 (type ac and then press backspace):

The if/else block on line 5818 now explicitly checks ignores items that have the class ui-screen-hidden, so in my case it will never find any times to display.

            if ( val.length < lastval.length || val.indexOf(lastval) !== 0 ) {

                // Removed chars or pasted something totally different, check all items
                listItems = list.children();
            } else {

                // Only chars added, not removed, only use visible subset
                listItems = list.children( ":not(.ui-screen-hidden)" );

If if replace the entire if/else block with listItems = list.children(); then it works.

jQuery Foundation member

@row1 - Thanks for reporting this. We will look into it.

Copied code in our JSBin template that loads latest code: (,html)

Change in behaviour is caused by commit 98b6ea3

jQuery Foundation member

I see there is a feature request (#4133) with a PR (#4135) that affects this part of the code. Might be a good idea to look into that request and this issue at the same time.

@gseguin gseguin was assigned Jul 19, 2012
jQuery Foundation member


In 1.3 we land a new option filterReveal for listviews with filter. This option initially hide all items. The option is also exposed as data- attribute: data-filter-reveal.
The option is already available in latest code on branch master:
Closing this issue because the new option will fix your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.