是否可以使用Kendo UI Grid将所有已更改的行列表或网格中包含的所有行重新发送回服务器?因为在InLine编辑模式下,当您保存时,将为网格中更改的每个元素触发_Update
事件。问题是,我需要一次全部。这是我的代码:
@(Html.Kendo().Grid<StrategyParameterModel>()
.Name("strategyParameters")
.Columns(columns =>
{
columns.Bound(c => c.Id).Width(170);
columns.ForeignKey(p => p.ParamType, (System.Collections.IEnumerable)ViewData["paramTypes"], "Key", "Value").Title("Param Type").Width(200);
columns.Bound(c => c.Key);
columns.Bound(c => c.Value);
columns.Bound(c => c.MinimumValue);
columns.Bound(c => c.MaximumValue);
columns.Bound(c => c.IncrementalValue);
})
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save();
})
//.ColumnMenu()
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Pageable(pager =>
pager.Refresh(true)
)
.Navigatable()
.Resizable(resize => resize.Columns(true))
.Sortable(sortable =>
{
sortable.SortMode(GridSortMode.SingleColumn);
sortable.AllowUnsort(false);
})
.Filterable(filterable => filterable.Mode(GridFilterMode.Menu))
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(100)
.Model(model =>
{
model.Id(p => p.Id);
model.Field(p => p.Id).Editable(false);
})
.Read(read => read.Action("StrategyParameter_Read", "StrategySets").Data("getStrategySetId"))
.Update(update => update.Action("StrategyParameter_Update", "StrategySets").Data("getStrategySetId"))
.Sort(sort => sort.Add("Id").Descending())
)
.Deferred()
)
控制器:
public ActionResult StrategyParameter_Update([DataSourceRequest]DataSourceRequest request, StrategyParameterModel parameters, int? strategySetId)
{
// parameters is one line only, should be a list of all lines...
var result = string.Empty;
return Json(result);
}
答案 0 :(得分:1)
我敢打赌,这可以像在edata源上启用批量编辑模式一样简单。
.DataSource(dataSource => dataSource
...
.Batch(true)
...
)