My aim is to delete the row when the Command Destroy column is clicked if the built in Confirmation popup if confirmed.
Want: Click Destroy Column > Confirm OK > ActionReult Triggered
Cannot use auto-sync since aiming at keeping other updates and inserts still require the save to be clicked to commit.
Currently the code will remove the row from the display when it is clicked as is built in.
And only after the save button for the grid is clicked does it trigger the ActionResult "OfficerDestroy" for doing so.
Seems there should be some event in this process that could trigger the ActionResult.
What are the options here for triggering that ActionResult while having a confirmation?
@(Html.Kendo().Grid<NexusPWI.ViewModels.Wizard.gridData>()
.Name("OfficerGrid")
.Columns(c => {
c.Bound(vm => vm.GridId); //Can display for testing purposes
c.Bound(vm => vm.FirstName).Width(50);
c.Bound(vm => vm.LastName).Width(50);
c.Bound(vm => vm.Title).Width(50);
c.Command(command => { command.Destroy(); }).Width(30);
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Navigatable()
.Pageable()
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Events(events => events.Error("officerGrid_error") // Handle the "error" event
.RequestEnd("officerGrid_RequestEnd") // Handle the "RequestEnd" event
.Change("officerGrid_Delete")
)
.Model(model => model.Id(vm => vm.GridId))
.PageSize(1000)
.Create("OfficerCreate", "Wizard")
.Read("OfficerRead", "Wizard")
.Update("OfficerUpdate", "Wizard")
.Destroy("OfficerDestroy", "Wizard")//.AutoSync(true)
))
<script>
function officerGrid_RequestEnd(e) {
if (e.type == "update" || e.type == "create") {
this.read();
}
}
</script>
public ActionResult OfficerDestroy([DataSourceRequest] DataSourceRequest request, IEnumerable<gridData> models)
{//This code works fine
}