Table Filter Not Working With Backspaces
I'm working on reproducing a live filter box with handsontable based on the built in search functionality at http://docs.handsontable.com/0.15.0-beta6/demo-search-for-values.html.
Solution 1:
You could add a condition inside of the .filter()
method that will return all rows if the value searchFiled.value
is empty or undefined:
var filtered = tData.filter(function(_, index) {
if (searchFiled.value) {
return rows.indexOf(index) >= 0;
} else {
returntrue;
}
});
Alternatively, here is a one-liner that does the same thing (although it is less readable):
var filtered = tData.filter(function(_, index) {
return !searchFiled.value || rows.indexOf(index) >= 0;
});
Post a Comment for "Table Filter Not Working With Backspaces"