Not sure if I'm missing something, but I have a destroy action in my grid and it's removing the row before even reaching Controller Method.
and then, if I get any error, the row is not in the grid anymore.
Destroy Method on Controller:
My Grid:
Am I missing something?
and then, if I get any error, the row is not in the grid anymore.
Destroy Method on Controller:
public
ActionResult DestroyCommission([DataSourceRequest]DataSourceRequest request, EditableCommission editable)
{
ModelState.AddModelError(
"Id"
,
"Error"
);
return
Json(
new
[] { editable }.ToDataSourceResult(request, ModelState));
}
My Grid:
<% this.Html.Kendo().Grid<
EditableCommission
>().Name("GridCommission").ToolBar(bar => bar.Create())
.DataSource(ds => ds.Ajax().Batch(false).ServerOperation(false)
.Read(read => read.Action("ReadCommission", "Commission").Data("getParam"))
.Create(create => create.Action("UpdateCommission", "CadastrarPedido").Data("getParam"))
.Update(update => update.Action("UpdateCommission", "CadastrarPedido").Data("getParam"))
.Destroy(destroy => destroy.Action("DestroyCommission", "Commission").Data("getParam"))
.Events(ev => ev.Error("error_handler.bind({WidgetID: '#GridCommission'})"))
.Model(model =>
{
model.Id(p => p.Id);
}))
.Events(events =>
{
events.Save("onSave");
events.Edit("onEdit");
})
.Columns(columns =>
{
columns.Bound(o => o.Id).Hidden(true);
columns.Bound(c => c.AgentId).Hidden(true);
columns.Bound(c => c.Agent).ClientTemplate("#=AgentName#").Width(180);
columns.Bound(o => o.Percentage).Width(95).Format("{0:N2}");
columns.Bound(o => o.Value).Width(90).Format("{0:N4}");
columns.Command(commands =>
{
commands.Edit();
commands.Destroy();
}).Width(120);
})
.Pageable(page => page.Refresh(true).PreviousNext(false).Input(false).Numeric(false).PageSizes(false))
.Editable(edit => edit.Mode(Kendo.Mvc.UI.GridEditMode.PopUp))
.Render(); %>
Am I missing something?