get idSelection() {
var
grid = $(
"#grid"
).data(
'kendoGrid'
);
var
row = grid.select();
if
(!row.is(
'.k-master-row'
)) {
row = row.closest(
".k-master-row"
);
}
const selected =
this
.grid.dataItem(row);
return
selected ? selected.Id : undefined;
}
6 Answers, 1 is accepted
Hi FranckSix,
Can you provide more details about the scenario in which you want to get the value of the hidden "id" column? To provide a relevant solution I will need to know the dependency of the Grids you mentioned. Can you create a Dojo project demonstrating the scenario in which you use the Grid/s?
Here are some examples you may find useful and may help you resolve the issue:
- https://docs.telerik.com/kendo-ui/knowledge-base/checkbox-selection-dataitems-selected-rows
- https://docs.telerik.com/kendo-ui/knowledge-base/checkbox-selection-dataitem-last-selected-row
- https://docs.telerik.com/kendo-ui/knowledge-base/grid-command-button-text-dataitem-property
Regards,
Petar
Progress Telerik

Here a snippet of what i want:
http://dojo.telerik.com/@FranckSix/iKIsInaf
Hello Francis,
My name is Nikolay and I will be covering my colleague Petar until he returns from his absence.
Setting the child id as this.grid.dataItem(e) does not return the correct id as grid.dataItem(e) refers to the master Grid. This could be avoided by creating a new grid instance and checking if a child row has fired it:
onChange: function (e) {
var grd = e.sender;
var isDetailGrid = grd.element[0].id.indexOf("detail") != -1;
var detailID;
if(isDetailGrid) {
detailID = grd.dataItem(grd.select());
}
var id = this.idSelection;
var idChild = detailID ? detailID.Id : "";
Please find the Dojo demo revised at the following link: http://dojo.telerik.com/AqARekul
Please let me know if you have any questions.
Regards,
Nikolay
Progress Telerik

Thanks! for the reply it's almost what I want.
The only thing left is that the selection of the two grids are independent. If I select something from group 2, it returns parent 1. I have to select parent 2 to return the correct ID.

Here is my latest version. It's exactly what I want to do :
It might be a good thing that Kendo implements the methods to get the data from the child and his parent. In fact, its use is currently very complicated. A very big thank you to you both. You made my day!
Hi Francis,
I am very happy to hear what I offered helped you resolve the situation.
Implementing these methods will be definitely discussed with the team and if needed, the necessary changes will be applied.
If there is anything else we could help with, please contact us back.
Regards,
Nikolay
Progress Telerik