Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Fix for issue #4133 - check all items on each change when custom filter callback applies #4135

Closed
wants to merge 1 commit into from

Conversation

cjindustries
Copy link

Fix for issue #4133 - check all items on each change when custom filter callback applies. This allows custom filters to truly add their own interpretation of the input filter value.

@cjindustries
Copy link
Author

Also permits forced re-filtering of the lists with $("#myList input.ui-input-text").trigger('change') after a listview refresh.

@@ -43,11 +43,16 @@ $( document ).delegate( ":jqmData(role='listview')", "listviewcreate", function(
itemtext = "",
item;

// Check if a custom filter callback applies
var isCustomFilterCallback = listview.options.filterCallback !=
$.mobile.listview.prototype.options.filterCallback;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think check only works when the callback is defined using the widget factory method

$( "#mylist" ).listview( 'option', 'filterCallback', yourFilterFunction );

If the user sets the value via the prototype options value eg,

$( document ).bind( "mobileinit", function(){
  $.mobile.listview.prototype.options.filterCallback = function(){
    console.log( "foo" );
  }
});

This check will always return true though it's clearly a custom callback.

@johnbender
Copy link
Contributor

Other than the inline comment I agree with the suggested behavior. This will probably have to wait until 1.2 though.

@johnbender
Copy link
Contributor

I'm going to close this one because we haven't seen a response on the filter comparison.

@johnbender johnbender closed this Aug 21, 2012
npmcomponent pushed a commit to npmcomponent/cbou-jquery-mobile that referenced this pull request Jan 8, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants