I guess I'm not understanding the hierarchical grid when it comes to editing.
Is the parent dataSource in no way connected to the child dataSources? So, when saving, I have to loop through and call save on every child grid?
Does it not use a hierarchical DataSource?
5 Answers, 1 is accepted
Grid hierarchy does not support hierarchical dataSource. Every Grid is a separate widget with separate DataSource. There is no way to connect the child's and parent's DataSources.
In order to save all changes it is required to loop through every child Grid and call its saveChanges method.
Regards,
Alexander Valchev
Telerik
[quote]
In order to save all changes it is required to loop through every child Grid and call its saveChanges method.
[/quote]
I assume you have to do this with a jQuery DOM selector? Can you suggest the best selector?
All child Grid elements has k-grid class. You may find them with jQuery find method. See the following example:
$(
"#grid"
).find(
".k-grid"
).each(
function
(index, element) {
$(element).data(
"kendoGrid"
).saveChanges();
});
Regards,
Alexander Valchev
Telerik
All child Grid elements has k-grid class. You may find them with jQuery find method. See the following example:
$(
"#grid"
).find(
".k-grid"
).each(
function
(index, element) {
$(element).data(
"kendoGrid"
).saveChanges();
});
Regards,
Alexander Valchev
Telerik
[/quote]
Hello Alexander, do you have a working example of this that you can show? I am trying to implement what you suggested but I dont know how or when exactly to call the function you have created so that when I make an edit to a field of my parent row, the same field for all the children rows get updated to this new value as well. Thank you!
Unfortunately, we do not have a working example of the discussed scenario, but in general, you can call the custom logic my colleague suggested in any custom event handler (e.g. a button click), as long as the parent Grid and its details Grids are initialized (the latter happens when a master row is expanded for the first time).
I hope this helps, but if you need further assistance, please send us an isolated runnable project, demonstrating the issue, so we can provide further assistance.
Regards,
Dimiter Topalov
Telerik