Question
I had a grid with EditMode of "GridEditMode.InCell".
Users can insert multiple data by Datasource ajax create method.
The create method works fine the first time.
However, when I tried to insert data the second time
The action recieved all of the data from view(includes the data already inserted in the first time).
How I can prevent from getting datas already inserted?
Is there any work arrounds?
@(Html.Kendo().Grid<Digitalization2.Web.Controllers.AgentOrder.CreateOrderDetailViewModel>()
.Name("agentordergrid")
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Batch(true)
.Model(model =>{
model.Id(x => x.ID);
model.Field(x => x.ID).Editable(false);
model.Field(x => x.ProductTypeView).DefaultValue(new ProductTypeViewModel(){ ParameterValue = "SD"});
model.Field(x => x.ProductModelView).DefaultValue(new ProductModelViewModel(){ProductID = 1, ProductModel = "SSD0100"});
})
.Read(read => read.Action("GetOrderDetailByOrderId", "AgentOrder", new { agentOrderId = @data.ID}))
.Create(create => create.Action("CreateAgentOrderDetail", "AgentOrder"))
.Destroy(destroy => destroy.Action("DeleteAgentOrdetDetails", "AgentOrder"))
)
.Columns(col => {
col.Bound(x => x.ProductTypeView).Width(150).ClientTemplate("#=ProductTypeView.ParameterValue#");
col.Bound(x => x.ProductModelView).Width(250).ClientTemplate("#=ProductModelView.ProductModel#");
col.Bound(x => x.ItemCount).Width(75);
col.Bound(x => x.UnitPrice).Width(150);
col.Bound(x => x.Remark).Width(500);
col.Command(command => command.Destroy()).Width(75);
})
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save().;
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
)