Commit 39ad3137 authored by David Stutz's avatar David Stutz

Merge pull request #555 from jedkirby/feature-full-text-searching

Adding the option to enable full value filtering.
parents cd515bef cfe97d32
...@@ -340,6 +340,7 @@ ...@@ -340,6 +340,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'
...@@ -903,12 +904,21 @@ ...@@ -903,12 +904,21 @@
} }
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) {
showElement = true; 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;
}
} }
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