JQM Selectmenu custom filter

JQM Selectmenu custom filter

Hi, I've got a problem using the custom filtering of a selectmenu.

First of all, the demo at  http://demos.jquerymobile.com/1.4.5/selectmenu-custom-filter/  throws an error for the long list example.

  1. // After the dialog is closed, the form containing the filter input is returned to the popup.
  2.     .on( "pagecontainerhide", function( event, data ) {
  3.         var listview, form;
  4.         // We only handle the disappearance of a dialog generated by a filterable selectmenu
  5.         if ( !pageIsSelectmenuDialog( data.toPage ) ) {
  6.             return;
  7.         }
  8.         listview = data.prevPage.jqmData( "listview" ), //THIS IS UNDEFINED
  9.         form = listview.jqmData( "filter-form" );
  10.         // Put the form back in the popup. It goes ahead of the listview.
  11.         listview.before( form );
  12.     });

I fix this by using this instead:
  1. .on( "pagecontainerhide", function( event, data ) {
  2.                 var listview, form;
  3.                 
  4.                 if ( !fPageIsSelectmenuDialog( data.prevPage ) ) {
  5.                     return;
  6.                 }
  7.                 listview = data.prevPage.jqmData( "listview" );
  8.                 if(listview)
  9.                 {
  10.                     form     = listview.jqmData( "filter-form" );
  11.                     listview.before( form );
  12.                 }
  13.             });

But then I have another problem. If you use the filter, then close the selectmenu and open it again. Clear the filter input, the list is truncated and wrongly positioned.

Am I missing something here?