I have a Grid that I want to edit in Batch mode. This all works as it should as in code below.
@(Html.Kendo().Grid<field>() .Name("myGrid") .HtmlAttributes(new { @class = "ignore" }) .ToolBar(toolbar => { if (pnlViewUserAccess == PageViewType.Edit || pnlViewUserAccess == PageViewType.Create) { toolbar.Create().HtmlAttributes(new { @class = "ignoreDirty" }); toolbar.Save(); } }) .Editable(editable => editable.Mode(GridEditMode.InCell)) .Scrollable(s => s.Height("auto")) .Columns(columns => { columns.Bound(p => p.key).Title("Key"); columns.Bound(p => p.label); columns.ForeignKey(p => p.fieldType, (System.Collections.IEnumerable)ViewData["FieldTypes"], "Value", "Text").Title("Field Type"); columns.Bound(p => p.valueLength).Title("Field Length"); columns.ForeignKey(p => p.searchable, (System.Collections.IEnumerable)ViewData["TrueFalse"], "Value", "Text").Title("Searchable"); columns.ForeignKey(p => p.access, (System.Collections.IEnumerable)ViewData["Access"], "Value", "Text").Title("Access"); columns.ForeignKey(p => p.active, (System.Collections.IEnumerable)ViewData["TrueFalse"], "Value", "Text").Title("Enabled"); columns.Bound(p => p.order).Title("Order"); }) .DataSource(dataSource => dataSource .Ajax() .Batch(true) .ServerOperation(false) .PageSize(40) .Model(model => { model.Id(p => p.oid); model.Field(x => x.key).Editable(false); model.Field(x => x.active).DefaultValue(true); model.Field(x => x.searchable).DefaultValue(false); model.Field(x => x.access).DefaultValue(3); }) .Events(e => e.Error("handleAjaxError")) .Update(update => update.Action("FieldDef_Update", "Forms")) .Create(update => update.Action("FieldDef_Create", "Forms")) .Read(read => read.Action("FieldDef_Read", "Forms", new { recordTypeOid = Model.Entity.Oid })) ))
I then had a requirement to be able to 'order' and save the order of the rows. I decided to use the Sortable - again this was fine I could drag the rows and then on the onChange event of Sortable I updated the Grid datasource Order numbers. All good!
However when I attempt to edit a cell I run into problems which I'll detail below:
- String\Text cell:
- dosnt retain the updated value or have the 'dirty' graphi iin top left of cell
- wont allow me to mouse click the right of the cell text - i have to use the arrow keys to append to the text.
- Numeric cell: cant use the spinners to update the number
On the Sortable widget I tried different variations of .Filter(), .Handler() etc.. but couldnt get it working properly. My Sortable code is below:
@(Html.Kendo().Sortable() .For("#myGrid") .ContainerSelector("#myGrid tbody") .Filter("table > tbody > tr") .Cursor("move") //.Handler(".isSortable") //.HintHandler("noHint") .PlaceholderHandler("myGrid_placeHolder") .Events(events => events.Change("myGrid_onChange")))