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

Update parent row value while add/update child row

1 Answer 263 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 04 May 2015, 09:09 AM
We have an parent child Telerik MVC grid. We placed child grid in one of the Tab ( used tab strip to display other parent row information in diffrent tabs along with child grid records). While editing/adding data in child grid, we need to update parent row values by using formulas. Is there any way to update parent row values without collapsing the parent row on OnRequestEnd event of child grid?

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 06 May 2015, 06:59 AM
Hi Ben,

Yes, you can update a data item of a grid by using its data source. For example (JavaScript):

// get a reference to the grid
var grid = $("#grid").data("kendoGrid")l
// get its data source
var dataSource = grid.dataSource();

// get some data item
var firstDataItem = dataSource.at(0);
// update a property of the data item
firstDataItem.set("FirstName", "New Value");
// sync the changes with the server-side
dataSource.sync();

You can execute this code in the OnRequestEnd of the child grid.

If the formula is calculated at the server side you should also initiate a read() operation of the parent grid so it gets the latest data:

dataSource.read();

Regards,
Atanas Korchev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
Ben
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or