This is a migrated thread and some comments may be shown as answers.

Kendo UI Grid Hierarchy how to get children(detail) IDs by clicking one of the row field

1 Answer 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Taffere
Top achievements
Rank 1
Taffere asked on 30 Jul 2014, 08:35 PM
I am trying to get all the children(detail) IDs when I click one of the row instead of using expand row. I want to click one of the detail row and get all the detail IDs. I tried calling detailInit from the click event but I am getting error. Either a way to get all child in an array? I am trying to get the IDs to call other service. Here is an example of a code.

When I click one of the detail row, I want to get all detail IDs in that row with out expanding the row. Please help me how to achieve this. I want to get OrderIDs. I have tried several methods but I am not able to achieve what I wanted.

<body>

<div id="example">
<div id="grid"></div>

<script>
$(document).ready(function() {
var element = $("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: {
read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Employees"
},
pageSize: 6,
serverPaging: true,
serverSorting: true
},
height: 600,
sortable: true,
pageable: true,
detailInit: detailInit,
dataBound: function() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
},
columns: [
{
field: "FirstName",
title: "First Name",
width: "110px"
},
{
field: "LastName",
title: "Last Name",
width: "110px"
},
{
field: "Country",
width: "110px"
},
{
field: "City",
width: "110px"
},
{
field: "Title",
title: "Detail"
}
]
});
});

function detailInit(e) {
$("<div/>").appendTo(e.detailCell).kendoGrid({
dataSource: {
type: "odata",
transport: {
read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders"
},
serverPaging: true,
serverSorting: true,
serverFiltering: true,
pageSize: 10,
filter: { field: "EmployeeID", operator: "eq", value: e.data.EmployeeID }
},
scrollable: false,
sortable: true,
pageable: true,
columns: [
{ field: "OrderID", width: "70px" },
{ field: "ShipCountry", title:"Ship Country", width: "110px" },
{ field: "ShipAddress", title:"Ship Address" },
{ field: "ShipName", title: "Ship Name", width: "300px" }
]
});
}
</script>
</div>


</body>
</html>




1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 01 Aug 2014, 08:56 AM
Hi Taffere,


I am not sure that I understand the exact case. Are you trying to detect click of a row in the master or detail Grid? Is this a click on the expand icon or the row itself? As a general tip, the detail rows (Grids) are not existing the DOM until they are expanded for the first time.

I am looking forward to hearing from you, so I could assist further.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Taffere
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or