Refresh Kendo MVC Detail Grid After Update

2 posts, 0 answers
  1. Matt Miller
    Matt Miller avatar
    23 posts
    Member since:
    Jan 2012

    Posted 18 Sep 2013 Link to this post

    I have a ajax bound grid with master / detail. Having problems getting the detail grid to refresh after saving an update. The data is saving correctly, you can see it update after i force the action method of the controller to be called by doing a sort. For that reason, i thought reading the datasource again from a client side event handler for the save event would do the trick. 

    Here's my client detail template in the view:

    <script id="matchedTrainTemplate" type="text/x-kendo-template">
                .Editable(editable => editable.Mode(GridEditMode.PopUp).Window(w => w.Modal(true)
                                                                                   .Resizable(x => x.Enabled(true))
                                                                                   //.Events(x => x.Close("ClosingEditWindow"))
                                                                                   )  )
              .Columns(columns =>
                    columns.Bound(o => o.MATCHING_GUID).Visible(false);
                    columns.Bound(o => o.N7_GUID).Visible(false);
                    columns.Bound(o => o.EDI_OWNER_CODE).Width("50");
                    columns.Bound(o => o.T94_OWNER_CODE).Width("50");
                    columns.Bound(o => o.EDI_EQUIPMENT_NUMBER).Width("75");
                    columns.Bound(o => o.T94_EQUIPMENT_NUMBER).Width("75");
                    columns.Bound(o => o.EDI_GROSS_WEIGHT).Width("75");
                    columns.Bound(o => o.EDI_TARE_WEIGHT).Width("75");
                    columns.Bound(o => o.T94_SEQUENCE_NUMBER);
                    columns.Command(commands => { commands.Edit(); }).Title("Edit Railcar").Width("50");            
                    columns.Bound(o => o.RREGUID).Visible(false);
                    columns.Bound(o => o.EDI_417_GUID).Visible(false);
                    columns.Bound(o => o.HeaderGuid).Visible(false);
                .DataSource(dataSource => dataSource.Ajax()
                                                    .Model(model => model.Id(o => o.MATCHING_GUID))
                                                    .Read(read => read.Action("MatchedEDI417sDetail", "MenuEDI", new { matchingGuid = "#=Id#" }).Type(HttpVerbs.Post))                                               
                                                    .Update(update => update.Action("MatchedEDI417sUpdate", "MenuEDI" , Model).Type(HttpVerbs.Post))                                               
                .Events( events => events.Save("detailSave"))
        function detailSave() {
            alert('Save Event');
    Here's the controller action method:

            public ActionResult MatchedEDI417sUpdate(MatchedT94EDI417Railcar railCar, [DataSourceRequest] DataSourceRequest request)
                TempData["role"] = GetRole();
                       return Json(matchedT94EDI417RailCarRepository.RailCarsMatchedT94EDI417(railCar.MATCHING_GUID).ToDataSourceResult(request));                

    Any suggestions appreciated.
  2. Matt Miller
    Matt Miller avatar
    23 posts
    Member since:
    Jan 2012

    Posted 18 Sep 2013 Link to this post

    nvm, i'm an idiot. i was returning the entire repository rather than the individual item being updated.
Back to Top