Edit In Hierarchy Grid Using Client Template ASP.Net Core

1 Answer 34 Views
Grid
Abhijeet
Top achievements
Rank 1
Abhijeet asked on 05 May 2024, 09:48 PM

I have a Hierarchy Grid similar to https://demos.telerik.com/aspnet-core/grid/hierarchy

In my child Grid i have used a Client template to add an image which on click calls a JQuery Function. I am passing row from grid in my JQuery function. I can not use Grid function as i need to do some pre and post validation in JQuery before my Controller method is called.

How do i get the Grid Id for child grid to retrieve the row clicked in my JQuery function. 

For the Parent gris i am able to achieve this using:

var tr = $(ev).closet("tr");

var dataItem = $("parentGridName").data("kendoGrid").dataItem(tr);

But for child grid since name is created dynamically how do i retrieve the row clicked.

1 Answer, 1 is accepted

Sort by
0
Mihaela
Telerik team
answered on 07 May 2024, 04:38 PM

Hello Abhijeet,

You can access the child Grid reference as follows:

var row = $(ev).closest("tr");
var childGridInstance= $(row).closest("[data-role=grid]").data("kendoGrid");
var dataItem = childGridInstance.dataItem(row);

Let me know if this approach works for you.

Regards,
Mihaela
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Abhijeet
Top achievements
Rank 1
commented on 25 May 2024, 05:33 PM

It worked, Thanks.
Tags
Grid
Asked by
Abhijeet
Top achievements
Rank 1
Answers by
Mihaela
Telerik team
Share this question
or