I currently have a a custom delete button in my toolbar. I want it to delete any record that has a check beside it in the grid with my Checkbox column. I also have batch editing enabled as well as Selectable as a way to see which record correlates with what you are doing. Here is my code.
@(Html.Kendo().Grid<MVCSQLDatabase.Models.Proposal>()
.Name("Grid")
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Batch(true)
.Model(model => model.Id(p => p.Proposal_Uid))
.Read(read => read.Action("Proposals_Read", "Grid"))
.Create(create => create.Action("Proposals_Create", "Grid"))
.Update(update => update.Action("Proposals_Update", "Grid"))
.Destroy(destroy => destroy.Action("Proposals_Destroy", "Grid"))
)
.Resizable(resize => resize.Columns(true))
.Columns(columns =>
{
columns.Select().Width(100);
columns.Bound(c => c.Pr).Width(215);
columns.Bound(c => c.P).Width(200);
columns.Bound(c => c.C).Width(190);
columns.Bound(c => c.Cli).Width(185);
columns.Bound(c => c.Total).Width(290);
columns.Bound(c => c.Md).Width(220);
columns.Bound(c => c.Start_Date).Format("{0: dd/MM/yyyy}").Width(170);
columns.Bound(c => c.End_Date).Format("{0: dd/MM/yyyy}").Width(170);
columns.Bound(c => c.Pqr).Width(235);
columns.Bound(c => c.Co).Width(215);
})
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save();
toolbar.Excel();
toolbar.Custom().Text("Delete").Name("Destroy").IconClass("k-icon k-i-close");
})
.ColumnMenu()
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Pageable()
.Selectable(selectable =>
{
selectable.Mode(GridSelectionMode.Multiple);
selectable.Type(GridSelectionType.Row);
})
.PersistSelection()
.Filterable(filterable => filterable.Mode(GridFilterMode.Row))
.Scrollable()
.HtmlAttributes(new { style = "height:835px;" })
)
It should delete from the grid AND my server when I put a checkmark in the check box and hit the delete button in the tool bar. It should also Delete as many records as I choose, and if I put a check in the box at the column header, it should delete all records. It should also only give 1 event of deletion regardless of how many records are actually deleted. I know I need a script, but I currently don't know how to write it correctly. Any help would be appreciated.