I have a MVC Grid as declared below what I want to do is instead of using the popup editor I want to edit and create rows in a custom template.
The 'GridFieldDefinitions_EditClick' function pops up a dialog and inserts my custom template 'templateField' into it. Basically any edits I make to the template I want reflected in the grid then I'll do my own custom batch Save to save all changes I did in the grid.
I'm having some problems reflecting the template changes into the grid.
1. Should these changes not be refelected automatically from my template?
2. If they are not why not?
3. If they are not meant to then I propose to use the Template Save button 'updateGridField' onClick method to reflect the cahnges to the grid - is this possible?
My template is as follows:
<script type="text/x-kendo-tmpl" id="templateField"> <div class="divFields"> @*<div style="overflow:auto; width:100%; height:10em; border:1px solid;">*@ <div> <table class="tbl2Cols"> <tr> <td>Uid</td> <td>#= data.uid #</td> </tr> <tr> <tr> <td>Oid</td> <td>#= data.oid #</td> </tr> <tr> <td>Key</td> # if (data.oid) { # <td>#= data.key #</td> #} else { # <td> <input class="k-textbox k-textbox person" data-val-required="The Key is required." id="key" name="key" style="width:100%" /> <span class="requiredAfter"></span> <span class="field-validation-valid" data-valmsg-replace="true" data-valmsg-for="key"></span> </td> # } # </tr> <tr> <td>Label</td> <td> <input data-bind="value:label" class="k-textbox" id="label" name="label" style="width:100%" value="#= data.label #" /> </td> </tr> <tr> <td></td> <td> <div id='#= data.uid #' class="k-button" onclick="updateGridField(this);" data-rowid="#= data.uid #">Save</div> </td> </tr> </table> </div> </div></script>@(Html.Kendo().Grid<field>() .Name("GridFieldDefinitions") .HtmlAttributes(new { @class = "ignore" }) //.ToolBar(toolbar => //{ // if (pnlViewUserAccess == PageViewType.Edit || pnlViewUserAccess == PageViewType.Create) // { // toolbar.Create().HtmlAttributes(new { @class = "ignoreDirty" }); // } //}) .Scrollable(s => s.Height("auto")) .Columns(columns => { if (pnlViewUserAccess == PageViewType.Edit || pnlViewUserAccess == PageViewType.Create) { columns.Command(command => command.Custom("Edit").Click("GridFieldDefinitions_EditClick")); } columns.Bound(p => p.order).Title("").HtmlAttributes(new { @class = "noEdit noCreate" }).Width(50); columns.Bound(p => p.key).Title("Key").HtmlAttributes(new { @class = "noEdit", @disabled = true }).Width(150); columns.Bound(p => p.label).Width(200); columns.Bound(p => p.valueLength).Title("Length").Width(100); }) .Events(e => e.Edit("GridFieldDefinitions_onEdit")) .DataSource(dataSource => dataSource .Ajax() .ServerOperation(false) .PageSize(40) .Model(model => { model.Id(p => p.oid); model.Field(p => p.oid).Editable(true); }) .Events(e => e.Error("handleAjaxError")) .Read(read => read.Action("FieldDef_Read", "Forms", new { recordTypeOid = Model.Entity.Oid })) ))The attached images use the exact same source code as below. The only difference is that one is aligned along the left side of the screen while the other is aligned along the right side. Any help or advice you could give would be greatly appreciated!
Code
01.@(Html.Kendo().Menu()02. .Name("Navigation")03. .HighlightPath(false)04. .Items(items =>05. {06. items.Add().Encoded(false).Text("<span class='fa fa-home'></span>").Action("Index", "Home");07. items.Add().Encoded(false).Text("<span class='fa fa-navicon' style='padding-right:6px;'></span>Navigation")08. .Items(item =>09. {10. item.Add().Encoded(false).Text("<span class='fa fa-desktop' style='padding-right:6px;'></span>Dashboard").Action("Index", "Dashboard");11. item.Add().Encoded(false).Text("<span class='fa fa-truck' style='padding-right:6px;'></span>Shipping").Action("Index", "Test")12. .Items(ship =>13. {14. ship.Add().Encoded(false).Text("<span class='fa fa-tachometer' style='padding-right:6px;'></span>Shop").Action("Shop", "Test");15. ship.Add().Encoded(false).Text("<span class='fa fa-truck' style='padding-right:6px;'></span>Ship").Action("Index", "Test");16. ship.Add().Encoded(false).Text("<span class='fa fa-globe' style='padding-right:6px;'></span>Track").Action("Index", "Track");17. });18. item.Add().Encoded(false).Text("<span class='fa fa-bar-chart-o' style='padding-right:6px;'></span>Report").Action("Index", "Reports");19. item.Add().Encoded(false).Text("<span class='fa fa-wrench' style='padding-right:6px;'></span>Tools").Action("Index", "Tools")20. .Items(tool =>21. {22. tool.Add().Encoded(false).Text("<span class='fa fa-print' style='padding-right:6px;'></span>Printing").Action("Index", "Print");23. tool.Add().Encoded(false).Text("<span class='fa fa-image' style='padding-right:6px;'></span>Image Cleanup").Action("Index", "ImageCleanup");24. });25. item.Add().Encoded(false).Text("<span class='fa fa-file' style='padding-right:6px;'></span>Billing").Action("Index", "Main");26. item.Add().Encoded(false).Text("<span class='fa fa-cogs' style='padding-right:6px;'></span>Admin").Action("Admin", "Admin");27. });28. })29.)