I've got a complex form, which requires a pop-up edit window. There are several hierarchical tables that also require editing. I hoped to do this with sub-grids, embedded in the editor template of the main grid.
However, I have encountered two issues.
However, I have encountered two issues.
- Passing the main ID to the read action of the sub grid - using the Model.ID doesn't work - it is just zero.
@(Html.Kendo().Grid<CDIFFAudit.Models.AntibioticHistory>() .Name("ahGrid") .Events(e=>e.Edit("onEditah")) .Columns(columns => { columns.Bound(p => p.ID).Title("ID"); columns.Bound(p => p.AntibioticID).Title("ID"); columns.Bound(p => p.StartDate).Title("Start").Format("{0:d}"); ; columns.Bound(p => p.Appropriate).Title("Appropriate?"); columns.Command(command => { command.Edit(); }); }) .ToolBar(commands=>commands.Create()).Editable(editable=>editable .Mode(GridEditMode.PopUp)) .DataSource(datasource => datasource .Ajax() .Model(m=>m.Id(p=>p.ID)) .PageSize(10) .Read(read => read.Action("GetAntibioticHistory", "CDIff", new { CDiffID = Model.ID })) .Create(create=>create.Action("insertAntibioticHistory","CDIff")) .Update(update=>update.Action("updateAntibioticHistory","CDiff")) ) .Pageable() .Sortable() .Filterable() )The only answer I can fin about this is this post (http://stackoverflow.com/questions/13384901/grid-into-grid-popup-editor-passing-id-parameter-in-sub-grid ) on StackOverflow , which seems like a complete bodge, and one I don't want, as I'll have at least four grids on this edit form (if it can be made to work).
- Editing the sub-grids data in a pop-up form doesn't work. When I hard-coded a real ID into the read method, the grid displayed data, but the pop-up form just displayed a 0 (screen shot attached).
I need to know whether kendo can support a complex editing scenario such as this, otherwise I'll have to take another route to achieve what's needed.