Skip to content
This repository

Listview with initially hidden items no longer works #4539

Closed
row1 opened this Issue June 17, 2012 · 3 comments

3 participants

Rowan Jasper de Groot Ghislain Seguin
Rowan
row1 commented June 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: http://jsfiddle.net/ULXbb/3/
It no longer works in jQuery Mobile 1.1 (type ac and then press backspace): http://jsfiddle.net/UHtAG/1/

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.

Jasper de Groot
Owner

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

Copied code in our JSBin template that loads latest code: http://jsbin.com/otepum/104/ (http://jsbin.com/otepum/104/edit#javascript,html)

Change in behaviour is caused by commit 98b6ea3

Jasper de Groot
Owner

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.

Jasper de Groot uGoMobi closed this January 01, 2013
Jasper de Groot
Owner

@row1

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: http://jsbin.com/otepum/338/edit
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.