gpt4 book ai didi

kendo-ui - 自定义网格中命令的编辑弹出窗口

转载 作者:行者123 更新时间:2023-12-04 04:59:30 25 4
gpt4 key购买 nike

有一个简单的剑道网格,带有编辑和销毁命令。

编辑命令显示一个弹出窗口,我可以在其中修改我的数据。
我需要自定义编辑窗口的标题和按钮文本(更新和取消按钮)。
这是我的代码:

var ds = createJSONDataSource();

function createJSONDataSource() {

var dataSource = new kendo.data.DataSource({

transport: {
autoSync: true,
read: {
type: "POST",
url: "WebServices/GetDataTest.asmx/getCustList",
dataType: "json",
contentType: mime_charset
}
},
pageSize: 5,
schema: {
data: function (data) {
if (data) {
if (serverSelectReturnsJSONString)
return $.parseJSON(data.d);

else
return data.d;
}
},
model:{
id: "customer_id",
fields: {
customer_id: { type: "string", editable: false },
name_customer: { type: "string" },
address_customer: { type: "string" }
}
}
});

var grid = $("#grid").kendoGrid({
selectable: true,
theme: "metro",
dataSource: ds,
scrollable: {
virtual: true
},
reorderable: true,
resizable: true,
pageable: true,
height: 300,
toolbar: ["save", "cancel"],
columns: [
{ field: "customer_id", title: "ID" },
{ field: "name_customer", title: "Cliente" },
{ field: "address_customer", title: "Indirizzo" },
{ field: "PI_customer", title: "Partita IVA", hidden: true },
{ field: "cap_customer", title: "CAP", hidden: true },
{ field: "city_customer", title: "Città" },
{ field: "state_customer", title: "Nazione", selected: false },
{ command: ["edit", "destroy"], title: " " }
],
filterable: true,
editable: "popup",
sortable: true,
columnMenu: {
messages: {
columns: "Scegli colonne",
filter: "Applica filtro",
sortAscending: "Ordina (ASC)",
sortDescending: "Ordina (DESC)"
}

},
groupable: {
messages: {
empty: "Trascina la colonna qui..."
}
}

});

希望有人帮助我!

提前致谢。

最佳答案

要自定义按钮,您应该将命令定义为:

{
name: "edit",
text: { update: "Actualizar", cancel: "Cancelar"}
},

我在哪里更换 Update来自 ActualizarCancel来自 Cancelar .

所以你的列定义将是:
columns: [
{ field: "customer_id", title: "ID" },
{ field: "name_customer", title: "Cliente" },
{ field: "address_customer", title: "Indirizzo" },
{ field: "PI_customer", title: "Partita IVA", hidden: true },
{ field: "cap_customer", title: "CAP", hidden: true },
{ field: "city_customer", title: "Città" },
{ field: "state_customer", title: "Nazione", selected: false },
{
command: [
{
name: "edit",
text: { update: "Actualizar", cancel: "Cancelar"}
},
"destroy"
],
title: " "
}
],

要更改窗口标题,您应该更改 editable: "popup",通过:
editable  : {
mode : "popup",
window : {
title: "Edición",
}
},

我将标题定义为 Edición .

关于kendo-ui - 自定义网格中命令的编辑弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16317078/

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