Skip to content

Commit 6bbf830

Browse files
committed
simple filterCallback in the options to delegate complex search to end users
1 parent 2d7706a commit 6bbf830

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

js/jquery.mobile.listview.filter.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
$.mobile.listview.prototype.options.filter = false;
1111
$.mobile.listview.prototype.options.filterPlaceholder = "Filter items...";
1212
$.mobile.listview.prototype.options.filterTheme = "c";
13+
$.mobile.listview.prototype.options.filterCallback = function( text, searchValue ){
14+
return text.toLowerCase().indexOf( searchValue ) === -1;
15+
};
1316

1417
$( ":jqmData(role='listview')" ).live( "listviewcreate", function() {
1518

@@ -70,7 +73,7 @@ $( ":jqmData(role='listview')" ).live( "listviewcreate", function() {
7073
// New bucket!
7174
childItems = false;
7275

73-
} else if ( itemtext.toLowerCase().indexOf( val ) === -1 ) {
76+
} else if ( listview.options.filterCallback( itemtext, val ) ) {
7477

7578
//mark to be hidden
7679
item.toggleClass( "ui-filter-hidequeue" , true );

0 commit comments

Comments
 (0)