I downloaded the sample and I can use the grid just fine with static data and sort and such. Filtering controls shows up, but no filtering is actually applied.
Try to define the rules of filters in a variable.
For example:
var db = {
loadData: function(filter) {
return $.grep(data, function (group) {
return (filter.courseId === undefined || group.courseId === filter.courseId)
&& (!filter.endDate || group.endDate.indexOf(filter.endDate) > -1);
});
}
}
Then add the variable as the value of the controller attribute when initializing jsGrid.
controller: db
$("#jsGrid").jsGrid({
height: "600px",
width: "100%",
filtering: true,
editing: true,
inserting: true,
sorting: true,
paging: true,
autoload: true,
pageSize: 15,
pageButtonCount: 5,
data: data,
controller: db
}
That did it! Thanks!
Se voc锚 veio em busca de uma solu莽茫o na qual apenas 1 linha 茅 selecionada e que tamb茅m desseleciona a mesma linha, aqui est谩 a solu莽茫o:
If you came looking for a solution in which only 1 line is selected and which also deselects the same line, here is the solution:
`selectedVal = null;
rowClick: function (args) {
selectedVal = args.item;
let $row = this.rowByItem(args.item);
if ($row.hasClass("highlight") === false) {
//Deseleciona todas as linhas
for (let i = 0; i < this.data.length; i++) {
this.rowByIndex(i).removeClass("highlight");
}
$row.toggleClass("highlight");
} else {
selectedVal = null;
$row.toggleClass("highlight");
}
console.log(selectedVal);
}`
Most helpful comment
Try to define the rules of filters in a variable.
For example:
var db = { loadData: function(filter) { return $.grep(data, function (group) { return (filter.courseId === undefined || group.courseId === filter.courseId) && (!filter.endDate || group.endDate.indexOf(filter.endDate) > -1); }); } }Then add the variable as the value of the controller attribute when initializing jsGrid.
controller: db
$("#jsGrid").jsGrid({ height: "600px", width: "100%", filtering: true, editing: true, inserting: true, sorting: true, paging: true, autoload: true, pageSize: 15, pageButtonCount: 5, data: data, controller: db }