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

Filterable: Add a data-no-filter attribute #8185

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions js/widgets/filterable.js
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ $.widget( "mobile.filterable", {
filterCallback: defaultFilterCallback,
enhanced: false,
input: null,
ignore: null,
children: "> li, > option, > optgroup option, > tbody tr, > .ui-controlgroup-controls > .ui-btn, > .ui-controlgroup-controls > .ui-checkbox, > .ui-controlgroup-controls > .ui-radio"
},

@@ -92,7 +93,7 @@ $.widget( "mobile.filterable", {
},

_filterItems: function( val ) {
var idx, callback, length, dst,
var idx, callback, length, dst, noFilter
show = [],
hide = [],
opts = this.options,
@@ -104,7 +105,8 @@ $.widget( "mobile.filterable", {

// Partition the items into those to be hidden and those to be shown
for ( idx = 0 ; idx < length ; idx++ ) {
dst = ( callback.call( filterItems[ idx ], idx, val ) ) ? hide : show;
noFilter = opts.ignore ? $( filterItems[ idx ] ).is( opts.ignore ) : false;
dst = ( !noFilter && callback.call( filterItems[ idx ], idx, val ) ) ? hide : show;
dst.push( filterItems[ idx ] );
}
}