Posted 24 Jan 2012
Link to this post
Hello everybody,
i'm trying to make one grid with Hierarchy, but the hierarchy grid return all rows everytime.
To populate the grids, i have two json files:
-OS.json to principal;
-ITEM.json to hierarchy grid;
OS.json:
[{"cdOS":474103,"cdSelb":"X112","solicitante":"CLEBSON "},
{"cdOS":474104,"cdSelb":"A335","solicitante":"FERNANDO "}]
ITEM.json:
[{"cdOS":474103,"status":"ABERTO","usuario":"nivaldo.oliveira"},
{"cdOS":474103,"status":"FECHADO","usuario":"carlos.alberto"},
{"cdOS":474104,"status":"ABERTO","usuario":"nivaldo.oliveira"},
{"cdOS":474104,"status":"FECHADO","usuario":"carlos.alberto"}]
<div id="grid"> </div>
$(document).ready(function() {
var element = $("#grid").kendoGrid({
dataSource: {
type: "json",
pageSize: 10,
serverPaging: true,
serverFiltering: true,
serverSorting: true,
transport: {
read: {
url: "js/OS.json",
dataType: "json"
},
schema: {
model: {
fields: {
cdOS: { type: "number" },
cdSelb: { type: "string" },
solicitante: { type: "string" }
}
}
}
}
},
height: 550,
filterable: true,
sortable: true,
pageable: true,
detailInit: detailInit,
dataBound: function() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
},
columns: [{
field: "cdOS",
title: "OS"
},
{
field: "cdSelb",
title: "SELB"
},
{
field: "solicitante",
title: "Solicitante"
}]
});
});
function detailInit(e) {
$("<div/>").kendoGrid({
dataSource: {
type: "json",
transport: {
read: {
url: "js/ITEM.json",
dataType: "json"
},
schema: {
model: {
fields: {
cdOS: { type: "number" },
status: { type: "string" },
usuario: { type: "string" }
}
}
}
},
serverPaging: true,
serverSorting: true,
serverFiltering: true,
pageSize: 6,
filter: { field: "cdOS", operator: "eq", value: e.data.cdOS }
},
scrollable: true,
sortable: true,
pageable: true,
columns: ["cdOS", "status","usuario"]
}).appendTo(e.detailCell);
}
Anybody can help-me to resolve this issue?
I wanna to return only two rows in hierarchy grid, for one row in principal grid, the link is "CdOS".
Thanks!