Update parent row value while add/update child row

2 posts, 0 answers
  1. Ben
    Ben avatar
    1 posts
    Member since:
    Feb 2015

    Posted 04 May 2015 Link to this post

    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?
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 06 May 2015 Link to this post

    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.

     
Back to Top