问题
I'm using a KendoUI KendoGrid. I have a column with delete button or "destroy" action. Kendo displays an alert box with the text "Are you sure you want to delete this record?" I need this text to be more specific to my situation. How do you customize this text?
Any help would be appreciated.
My code for adding the columns is:
$reports.kendoGrid(
{
dataSource: dataSource,
pageable: {
refresh: true,
pageSizes: true
},
toolbar: [{ name: "create", text: "Add" }],
columns:
[
{ field: 'name', title: 'Report', sortable: true },
{ command: ["edit", "destroy"], title: " ", width: "180px", }
],
editable: "inline",
selectable: true,
回答1:
according to the Kendo Grid documentation:
editable.confirmation Boolean | String
Defines the text that will be used in confirmation box when delete an item.
回答2:
If you are using Kendo UI for ASP.NET MVC you can use DisplayDeleteConfirmation
@(Html.Kendo().Grid<OrdersViewModel>()
.Name("Orders")
.HtmlAttributes(new {style = "height: 100%; border-width: 0;"})
.Columns(c =>
{
c.Bound(p => p.Id)
.Width(50)
}
.Editable(editable =>
{
editable.Mode(GridEditMode.InLine);
editable.DisplayDeleteConfirmation("Your Message here");
}))
回答3:
Replace
editable: "inline"
with
editable: {
confirmation: "Your custom message",
mode: "inline"
},
来源:https://stackoverflow.com/questions/12570188/how-to-change-the-text-on-kendo-ui-grid-destroy-or-delete-command-action