jquery-archive / jquery-mobile

jQuery Mobile Framework
https://jquerymobile.com
Other
9.69k stars 2.4k forks source link

jqm 1.4.3 selectmenu-custom-filter dialog bug(also in 1.4.5) #8133

Closed DavidVdd closed 8 years ago

DavidVdd commented 9 years ago

When using the selectmenu-custom-filter as in the demo(http://demos.jquerymobile.com/1.4.3/selectmenu-custom-filter/ and http://demos.jquerymobile.com/1.4.5/selectmenu-custom-filter/ ) the custom select menu turns into a dialog when the screen is too small. When the screen gets bigger the searchfiltertextbox isn't visible anymore and not all items are displayed if you still had a value.(see image below)

prtscr capture_4

This can be easily replicated when changing the screensize of your browser so you get the dialog select and then increase the size of the screen again. This happens when a user switches to landscape and back to portrait in my app.

1.4.3 is as explained. 1.4.5 gets stuck in dialog with exception "Uncaught TypeError: Cannot read property 'jqmData' of undefined" It seems to work fine in 1.4.2.

How can I fix this? I'm using 1.4.3 currently.

DavidVdd commented 9 years ago

Changing the last block(toPage -> prevPage) in 1.4.3 seems to solve my problem: Old code:

.on( "pagecontainerhide", function( event, data ) {
    var listview, form,
        id = data.toPage && data.toPage.attr( "id" );
    if ( !( id === "filter-menu-dialog" || id === "title-filter-menu-dialog" ) ) {
        return;
    }
    listview = data.toPage.jqmData( "listview" ),
    form = listview.jqmData( "filter-form" );
    // Put the form back in the popup. It goes ahead of the listview.
    listview.before( form );
});

Changed to:

.on( "pagecontainerhide", function( event, data ) {
    var listview, form,
        id = data.prevPage && data.prevPage.attr( "id" );
    if ( !( id === "filter-menu-dialog" || id === "title-filter-menu-dialog" ) ) {
        return;
    }
    listview = data.prevPage.jqmData( "listview" ),
    form = listview.jqmData( "filter-form" );
    // Put the form back in the popup. It goes ahead of the listview.
    listview.before( form );
});

Is this correct?

apsdehal commented 8 years ago

Closing as I am not able to reproduce on latest chrome with 1.4.5 demos. If problem persists, reopen.