I was looking into this example and saw that filtering does not happen when searching for empty cells. This means I typed any string in the filterbox and then removing the string. However, when debugging it locally and making some cells empty, I saw that dataview.refresh()
is called upon an empty input, the grid just doesn't display the empty cells.
In my application I have a use case where one might want to search for all cells that have no content, so my question is, is this something that can be changed, or is it baked deeply under the Slickgrid hood?
I can understand the use case in the linked example, as it already loads the filters on page load, but in my application the filter is only applied after a confirmation button click.
Thanks for your help.
This is all completely configurable. In the example you link,
dataView.setFilter(filter);
sets up the filtering, and passes the filter function
function filter(item) {
for (var columnId in columnFilters) {
if (columnId !== undefined && columnFilters[columnId] !== "") {
var c = grid.getColumns()[grid.getColumnIndex(columnId)];
if (item[c.field] != columnFilters[columnId]) {
return false;
}
}
}
return true;
}
To make the changes you suggest, simply edit the columnFilters[columnId] !== ""
bit. You'll need to work out some other way of telling whether to apply the filter or not, rather than an empty string.