I want to change confirmation popup from synchronous browser popup to asynchronous popup (alertify). I found some old threads in Telerik MVC Extensions (http://www.telerik.com/community/forums/aspnet-mvc/grid/delete-a-row-programmatically.aspx), but this code is not working for me.
How can I delete row programatically?
I already attached to Delete event and prevent remove row, but I can't remove it programatically on positive confirmation callback (callback was called but nothing happens).
How prevent deleting row in client side too? - return false or e.preventDefault cancel remote delete call but row was removed from view.
Here is my javascript delete handler code:
Here is grid MVC builder code:
How can I delete row programatically?
I already attached to Delete event and prevent remove row, but I can't remove it programatically on positive confirmation callback (callback was called but nothing happens).
How prevent deleting row in client side too? - return false or e.preventDefault cancel remote delete call but row was removed from view.
Here is my javascript delete handler code:
function
deleteRow(e) {
/* How prevent delete row in client side too - return false or e.preventDefault cancel remote delete call but row was removed from view */
alertify.confirm(
"dddd"
,
function
(result) {
if
(result) {
e.sender.removeRow(e.row);
/* not removing row */
}
});
return
false
;
}
@(Html.Kendo().Grid(Model.Franchises)
.Name("franchisesGrid")
.Columns(columns =>
{
columns.Bound(p => p.Name);
columns.Bound(p => p.CompanyName);
columns.Command(command =>
{
command.Edit().Text(LocalizationResources.Update).CancelText(LocalizationResources.Cancel).UpdateText(LocalizationResources.OK);
command.Destroy().Text(LocalizationResources.Remove);
});
})
.Groupable()
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.ColumnMenu()
.ToolBar(toolbar =>
{
toolbar.Template(@<
text
>
<
div
class
=
"row control-group"
>
<
div
class
=
"span10"
>
<
a
class
=
"btn k-btn-add k-grid-add"
><
span
class
=
"k-icon k-add"
></
span
>@LocalizationResources.Create</
a
>
</
div
>
</
div
>
</
text
>);
})
.Resizable(resize => resize.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
.Editable(editable =>
{
editable.Mode(GridEditMode.PopUp).Window(builder => builder.Title("Title"));
editable.DisplayDeleteConfirmation(false);
})
.Events(builder => builder.Remove("deleteRow"))
.DataSource(dataSource => dataSource
.Ajax()
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.Id))
.Read("Get", "Home")
.Create("Create", "Home")
.Update("Update", "Home")
.Destroy("Remove", "Home")))