gpt4 book ai didi

javascript - 在 Kendo Ui Grid 弹出窗口中更改按钮文本

转载 作者:数据小太阳 更新时间:2023-10-29 03:59:48 25 4
gpt4 key购买 nike

我有一个 Kendo UI Grid,它会在创建新记录或编辑现有记录时加载弹出窗口。

当我创建新记录时,我努力寻找一种方法将“更新”按钮的文本更改为“保存”(它当前显示“更新”- 但它不正确)。

我能够更改弹出窗口的标题,但我的问题是:如何更改按钮文本?

这是代码:

 $("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
sortable: true,
groupable: true,
height: resizeGrid(),
filterable: true,
toolbar: ["create"],
columns: [
{ field: "OfficeName", title: "Office Name" },
{ field: "SupportNo", title: "Phone No.", width: "100px" },
{ field: "SupportEmail", title: "Email Address", width: "130px" },
{ field: "SupportFax", title: "Fax No.", width: "100px" },
{ field: "SupportFtp", title: "Ftp Url", width: "150px" },
{ command: ["edit", "destroy"], title: "Actions", width: "160px" }],
editable: "popup",
edit: function (e) {
var editWindow = e.container.data("kendoWindow");

if (e.model.isNew()) {
e.container.data("kendoWindow").title('Add New Office');
$(".k-grid-update").text = "Save";
}
else {
e.container.data("kendoWindow").title('Edit Office');
}
}
});

最佳答案

你应该将command定义为:

command: [
{
name: "edit",
text: {
edit: "Edit", // This is the localization for Edit button
update: "Save", // This is the localization for Update button
cancel: "Cancel changes" // This is the localization for Cancel button
}
},
{
name: "destroy",
text: "Delete Office" // This is the localization for Delete button
}
]

此外,如果您还想更改弹出窗口中的文本Edit,您应该使用:

editable  : {
mode : "popup",
window : {
title: "Edit Office", // Localization for Edit in the popup window
}
}

关于javascript - 在 Kendo Ui Grid 弹出窗口中更改按钮文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16927841/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com