C# 如何更改 Kendo UI Grid 上的文本销毁或删除命令操作?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12570188/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change the text on Kendo UI Grid destroy or delete command action?
提问by Rodney
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?
我正在使用 KendoUI KendoGrid。我有一个带有删除按钮或“销毁”操作的列。Kendo 显示一个带有文本“您确定要删除此记录吗?”的警告框。我需要这篇文字更具体地针对我的情况。您如何自定义此文本?
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,
采纳答案by MrOBrian
according to the Kendo Grid documentation:
editable.confirmationBoolean | String
editable.confirmation布尔值 | 细绳
Defines the text that will be used in confirmation box when delete an item.
定义删除项目时将在确认框中使用的文本。
回答by Vlad Bezden
If you are using Kendo UI for ASP.NET MVC you can use DisplayDeleteConfirmation
如果您使用的是 ASP.NET MVC 的 Kendo UI,您可以使用 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");
}))
回答by Maverick
Replace
代替
editable: "inline"
with
和
editable: {
confirmation: "Your custom message",
mode: "inline"
},

