From 6bbf830da8772cdbe2ece9d8138c7c1e3c9dcb0e Mon Sep 17 00:00:00 2001 From: John Bender Date: Wed, 3 Aug 2011 17:10:44 -0700 Subject: [PATCH] simple filterCallback in the options to delegate complex search to end users --- js/jquery.mobile.listview.filter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/jquery.mobile.listview.filter.js b/js/jquery.mobile.listview.filter.js index 7b283397..b645ecc4 100644 --- a/js/jquery.mobile.listview.filter.js +++ b/js/jquery.mobile.listview.filter.js @@ -10,6 +10,9 @@ $.mobile.listview.prototype.options.filter = false; $.mobile.listview.prototype.options.filterPlaceholder = "Filter items..."; $.mobile.listview.prototype.options.filterTheme = "c"; +$.mobile.listview.prototype.options.filterCallback = function( text, searchValue ){ + return text.toLowerCase().indexOf( searchValue ) === -1; +}; $( ":jqmData(role='listview')" ).live( "listviewcreate", function() { @@ -70,7 +73,7 @@ $( ":jqmData(role='listview')" ).live( "listviewcreate", function() { // New bucket! childItems = false; - } else if ( itemtext.toLowerCase().indexOf( val ) === -1 ) { + } else if ( listview.options.filterCallback( itemtext, val ) ) { //mark to be hidden item.toggleClass( "ui-filter-hidequeue" , true );