Commit 7c57b6bc authored by James Kirby's avatar James Kirby

Adding the option to enable full value filtering.

parent 6367ced0
...@@ -320,6 +320,7 @@ ...@@ -320,6 +320,7 @@
selectAllNumber: true, selectAllNumber: true,
enableFiltering: false, enableFiltering: false,
enableCaseInsensitiveFiltering: false, enableCaseInsensitiveFiltering: false,
enableFullValueFiltering: false,
enableClickableOptGroups: false, enableClickableOptGroups: false,
filterPlaceholder: 'Search', filterPlaceholder: 'Search',
// possible options: 'text', 'value', 'both' // possible options: 'text', 'value', 'both'
...@@ -881,13 +882,22 @@ ...@@ -881,13 +882,22 @@
} }
if (value !== this.options.selectAllValue && text) { if (value !== this.options.selectAllValue && text) {
// By default lets assume that element is not // By default lets assume that element is not
// interesting for this search. // interesting for this search.
var showElement = false; var showElement = false;
if (this.options.enableCaseInsensitiveFiltering && filterCandidate.toLowerCase().indexOf(this.query.toLowerCase()) > -1) { if (this.options.enableCaseInsensitiveFiltering) {
filterCandidate = filterCandidate.toLowerCase();
this.query = this.query.toLowerCase();
}
if( this.options.enableFullValueFiltering && this.options.filterBehavior !== 'both' ) {
var valueToMatch = filterCandidate.trim().substring(0, this.query.length);
if( this.query.indexOf(valueToMatch) > -1 ){
showElement = true; showElement = true;
} }
}
else if (filterCandidate.indexOf(this.query) > -1) { else if (filterCandidate.indexOf(this.query) > -1) {
showElement = true; showElement = true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment