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:
Here's the controller action method:
Any suggestions appreciated.
Here's my client detail template in the view:
<script id="matchedTrainTemplate" type="text/x-kendo-template"> @(Html.Kendo().Grid<CNX.Domain.Entities.MatchedT94EDI417Railcar>() .Name("MatchingEDI417s_#=Id#") .Editable(editable => editable.Mode(GridEditMode.PopUp).Window(w => w.Modal(true) .Width(500) .Height(510) .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() .PageSize(10) .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)) ) .Pageable() .Sortable() .Filterable() .Events( events => events.Save("detailSave")) .ToClientTemplate() ); </script><script> function detailSave() { alert('Save Event'); this.dataSource.read(); }</script>[HttpPost] public ActionResult MatchedEDI417sUpdate(MatchedT94EDI417Railcar railCar, [DataSourceRequest] DataSourceRequest request) { TempData["role"] = GetRole(); matchedT94EDI417RailCarRepository.Save(railCar); return Json(matchedT94EDI417RailCarRepository.RailCarsMatchedT94EDI417(railCar.MATCHING_GUID).ToDataSourceResult(request)); }Any suggestions appreciated.