如何更改Kendo UI Grid的销毁或删除命令操作上的文本?

14

我正在使用KendoUI KendoGrid。我有一列带有删除按钮或“destroy”操作。Kendo显示一个带有文本“您确定要删除此记录吗?”的警报框,我需要将此文本更具体地针对我的情况进行自定义。如何自定义此文本?

任何帮助都将不胜感激。

我添加列的代码如下:

$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,
3个回答

26
如果你正在使用Kendo UI for ASP.NET MVC,你可以使用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");
                  }))

但是你如何传递该顺序以在DeleteConfirmation消息中显示它? - mavi

10

根据 Kendo Grid 文档:

editable.confirmation 布尔值 | 字符串

定义在删除项目时将用于确认框中的文本。


2
谢谢:我加入了以下可编辑行:editable: { mode: "inline", confirmation: "哦,疯了!!您确定要删除此报告以及所有包含的部分和内容吗?" }, - Rodney Hickman

3
替换
editable: "inline"

使用

editable: {
    confirmation: "Your custom message",
    mode: "inline"
},

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接