Hello,
I am using MVC wrappers without Edit button (Add and Delete only). What is the better way to prevent to delete very last record in the grid? I could use command().hidden(bool) but have not figured out yet how to wire JavaScript function there.
Thanks.
@(Html.Kendo().Grid<WebApplication42.Models.Phone>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.PhoneID);
columns.Bound(p => p.PhoneNumberInt);
columns.Bound(p => p.PhoneNumberString);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine).ConfirmDelete("Delete").DisplayDeleteConfirmation("Are you sure to delete?"))
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "auto;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Model(model => model.Id(p => p.PhoneID))
.Create(update => update.Action("EditingInline_Create", "Grid"))
.Read(read => read.Action("EditingInline_Read", "Grid"))
.Update(update => update.Action("EditingInline_Update", "Grid"))
.Destroy(update => update.Action("EditingInline_Destroy", "Grid"))
.Events(e => e.Error("onPhoneError"))
)
)