i created a testing grid (hierarchial grid) to be applied in our project. problem is that the datasource filter didn't apply the matching id (employee's id column to subordinate's ReportingTo column).
<
body
>
<
div
id
=
"testGrid"
></
div
>
<
script
>
var employee = [{
empID: 1, lastName: "Sarsonas", firstName: "Christine", ReportingTo: 0
},
{
empID: 2, lastName: "Sarsonas", firstName: "Alyssa", ReportingTo: 0,
}
];
var subordinate = [
{
empID: 10, lastName: "Hatake", firstName: "Kakashi", ReportingTo: 1
},
{
empID: 11, lastName: "Maito", firstName: "Gai", ReportingTo: 1
}
];
$("#testGrid").kendoGrid({
columns: [
{ title: "Emp ID", field: "empID" },
{ title: "Last Name", field: "lastName" },
{ title: "First Name", field: "firstName" },
{ title: "Reporting To", field: "ReportingTo" }
],
dataSource: { data: employee },
detailInit: detailInit
,dataBound: function() {
this.expandRow(this.tbody.find("tr.k-master-row"));
}
});
function detailInit(e) {
console.log(e.data.empID);
$("<
div
/>").appendTo(e.detailCell).kendoGrid({
dataSource: {
data: subordinate,
serverPaging: true,
serverSorting: true,
serverFiltering: true,
pageSize: 10,
filter: { field: "ReportingTo", operator: "eq", value: e.data.empID }
},
scrollable: false,
sortable: true,
pageable: true,
columns: [
{ title: "Emp ID", field: "empID" },
{ title: "Last Name", field: "lastName" },
{ title: "First Name", field: "firstName" },
{ title: "Reporting To", field: "ReportingTo" }
]
});
}
</
script
>
</
body
>