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

Projects
None yet
2 participants
@cjindustries

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

This comment has been minimized.

Show comment Hide comment
@cjindustries

cjindustries Apr 20, 2012

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

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;

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender May 21, 2012

Contributor

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

johnbender May 21, 2012

Contributor

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

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender May 21, 2012

Contributor

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

Contributor

johnbender commented May 21, 2012

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

@johnbender

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender Aug 21, 2012

Contributor

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

Contributor

johnbender commented Aug 21, 2012

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 join this conversation on GitHub. Already have an account? Sign in to comment