Reputation: 970
The Fiddle , I have a SlickGrid witch get filled with Ajax and I can search in one column. This is all explained well in an example of SlickGrid. Now I would like to make a custom filter. This filter is a text field and can search in multiple columns. (all columns actually) With the code I found here. This is the code I have:
grid = new Slick.Grid("#myGrid", dataView, columns, options);
$('#txtSearch').keyup(function (e) {
var searchList = $.trim(this.value.toLowerCase()).split(' ');
dataView.setFilter(gridFilter);
grid.invalidate();
this.focus();
});
function gridFilter(rec) {
var found;
for (i = 0; i < gridSearchList.length; i += 1) {
found = false;
$.each(rec, function (obj, objValue) {
if (typeof objValue !== 'undefined' && objValue != null
&& objValue.toString().toLowerCase().indexOf(gridSearchList[i]) != -1) {
found = true;
return false; //this breaks the $.each loop
}
});
if (!found) {
return false;
}
}
return true;
}
Currently I'm getting a "Uncaught SyntaxError: Undefined label '_coreloop'" in the slick.dataview.js file when I try to do the .setFilter(). What could be wrong with the code? Variable gridSearchList is the data(array) I got from Ajax. Thanks!
Upvotes: 1
Views: 2299
Reputation: 9082
Your filter code doesn't seem compatible with SlickGrid's filter inlining. Turn it off in the DataView.
Upvotes: 2