This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_defaultFilter: function(value, headerName) { | |
var match = RegExp(this.filters[headerName], 'i'); | |
return match.test(value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eFilterCustom: function(headerName, filterValue, item) { | |
switch(headerName) { | |
case "ID": | |
switch(filterValue) { | |
case "Selected": | |
return item.selected; | |
case "Not Selected": | |
return !item.selected; | |
default: | |
return this._defaultFilter(item.id, headerName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eFilter: function(item) { | |
var valid = true; | |
// this.filters is an Object that holds existing filters in all columns. | |
// Key is column name, value is filter value | |
// For example: {Dessert: "Cake", Calorie: /^\d{3}$/g}; Calorie filter is a regex indicating that number needs to have 3 digits | |
// This filter means to show only rows that have Cake in its Dessert column and 3 digits Calorie value | |
for (var headerName in this.filters) { | |
valid = valid && this.eFilterCustom(headerName, this.filters[headerName], item); | |
} | |
return valid; |