How to change the text on Kendo UI Grid destroy or delete command action?

﹥>﹥吖頭↗ 提交于 2020-01-11 08:13:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!