I needed to show two groups for filtering so I adjusted the code a bit to support this. I hacked this in half an hour and it serves for me perfectly. If somebody wants to extend this for more records, it is pretty easy.
First split the input into multiple strings, then change the comparison string. I hope it serves someone. Many thanks for creating dynatable, it is really cool!!!
if (settings.dataset.queries.hasOwnProperty(query)) {
var value = settings.dataset.queries[query].toString();
res = value.split(',');
if (_this.functions[query] === undefined) {
// Try to lazily evaluate query from column names if not explicitly defined
var queryColumn = utility.findObjectInArray(settings.table.columns, {id: query});
if (queryColumn) {
_this.functions[query] = function(record, queryValue) {
return record[query] == queryValue;
};
} else {
$.error("Query named '" + query + "' called, but not defined in queries.functions");
continue; // to skip to next query
}
}
// collect all records that return true for query
settings.dataset.records = $.map(settings.dataset.records, function(record) {
// _this.functions[query](record, res[0]) ? record : null;
if ( _this.functions[query](record, res[0]) || _this.functions[query](record, res[1])) {
return record ;}
else {
return null;
}
});
}
I needed to show two groups for filtering so I adjusted the code a bit to support this. I hacked this in half an hour and it serves for me perfectly. If somebody wants to extend this for more records, it is pretty easy.
First split the input into multiple strings, then change the comparison string. I hope it serves someone. Many thanks for creating dynatable, it is really cool!!!