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

Working with Kendo Grid Hierarchy - Edit rows

1 Answer 281 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Safira
Top achievements
Rank 1
Safira asked on 07 Aug 2013, 04:17 PM
Hi everyone,
I am using Kendo Grid Hierarchy in my ASP.Net MVC application.

For each row in my parent table, i have an option to add a child table.

My parent table is associated with a model. Each row in this parent table has several columns:
- ID
- Name
- Amount
- Button
Every time i add a parent row, all values are empty (ID and Name).

Now, here is my problem:

When my parent row has a child table filled with rows, e need to hide the button in the parent row. 
When i remove my child table, i need to show the buttons again.
I also need to fill a hidden column in the child table, which indicates me who is the parent row.

How can i do this, only in the client side (using javascript)? I want to edit my information inline, and i would like to make a post only after my editing is completed, serializing my table to JSON and sending it to the server.

Thanks in advance.

Best regards

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 12 Aug 2013, 06:46 AM
Hello Safira,

 Hiding and showing the button can be done with a client template. Something like this:

  ClientTemplate("# if (!HasChildren) { # <button class='k-button'>Detail</button> # } #")

 Where HasChilren is a field of the model telling whether the current data item has children or not.

 To set fields of the child grid you need to use its data source and its API.

 Sending the whole child table as JSON won't be that easy though. The child grid is a grid of its own with its separate DataSource configuration (action methods which will perform CRUD). You can check this tutorial for a sample implementation: http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/client-detail-template#client-hierarchy

Let us know if you have further questions!

Regards,
Atanas Korchev
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
Safira
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or