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

Sub grid batch edits lost when adding a row

3 Answers 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 28 Sep 2015, 09:02 PM

We have a batch edit grid with a sub batch edit grid. It all works fine unless we want to add a row. When we do the sub grid edits are lost. 

Is this a bug, or not supported?

 

 

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 30 Sep 2015, 11:00 AM
Hi Bob,

The behaviour is expected and occurs because the child grid is destroyed and re-created when its parent Grid rebinds.
Adding a new row to the parent triggers the rebind action.

As a workaround you may hook up to the dataBinding event of the parent Grid and call the saveChanges method of the child.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bob
Top achievements
Rank 1
answered on 30 Sep 2015, 01:48 PM

That's essentially what I am doing. But, as you say a "workaround", it would be nice if a hierarchical data source is used so existing child records would be re-bound as well. At least, I think that's what the hierarchical datasource give you, maybe I don't fully understand it either.

What is the recommended way to find the rows that have child grids attached to them that need to be saved? My way seems quite a bit kludgy.

 

 

0
Alexander Valchev
Telerik team
answered on 02 Oct 2015, 10:43 AM
Hello Bob,

You may use role selector to select all Grid elements.

$("#parentGrid")
  .find("[data-role=grid]")
  .each(function(idx, element) { console.log(element); });


But, as you say a "workaround", it would be nice if a hierarchical data source is used so existing child records would be re-bound as well. At least, I think that's what the hierarchical datasource give you, maybe I don't fully understand it either.

Thank you for the feedback, I will forward your suggestion to the team for further discussions.

Regards,
Alexander Valchev
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
Bob
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Bob
Top achievements
Rank 1
Share this question
or