在 Kendo 网格 - 编辑选项如何 hide/show 保存按钮 如果没有更改或有一些更改则显示
In Kendo Grid - Edit option how to hide/show the save button If there are no changes or some changes then show
能否告诉我如何根据用户是否对编辑文本框进行了一些更改来 Hide/Show 保存按钮,例如如果没有对编辑文本框进行任何更改,那么我们应该隐藏保存按钮。如果用户对编辑文本框进行了任何更改,那么我们应该显示保存按钮。
网格图像:
这是我的代码:
$(function() {
$("#grid").kendoGrid({
dataSource: new kendo.data.DataSource({
data: [{ SystemName: "SysTest", SystemID: "789" }],
serverPaging: false,
serverSorting: false,
serverFiltering: false,
batch: true,
/*filter: { logic: 'and', filters: [] }, //set the default it is passed as a value
sort: [], //set the default it is passed as a value */
schema: {
//data: "Items",
model: {
id: "SystemID",
fields: {
SystemName: { editable: true, nullable: true, type: "string" },
SystemID: { editable: false, nullable: false },
}
}
}
}),
columns: [
{
field: "SystemName",
title: "Some Name",
horizontalAlign: "left",
headerAttributes: { style: "text-align: left; width: 75%;" },
width: '45%',
encoded: false,
name: "SystemName"
}, {
field: "SystemID",
title: "SystemID",
horizontalAlign: "left",
headerAttributes: { style: "text-align: left; width: 75%;" },
width: '25%',
encoded: false,
name: "SystemID"
},
{
command: [{
name: "edit",
text: {
edit: "Edit", // This is the localization for Edit button
update: "Save", // This is the localization for Update button
cancel: "Cancel" // This is the localization for Cancel button
}
}], title: " ", width: "50%"
}],
editable: "inline",
sortable: false,
resizable: true,
autoBind: true,
navigateHierarchyCell: true,
persistSelections: true,
pageable: false,
autoResizeHeight: false
}).data('kendoGrid');
});
这是我的答案 -
change: function (e) {
$(".k-grid-update").show();
}
能否告诉我如何根据用户是否对编辑文本框进行了一些更改来 Hide/Show 保存按钮,例如如果没有对编辑文本框进行任何更改,那么我们应该隐藏保存按钮。如果用户对编辑文本框进行了任何更改,那么我们应该显示保存按钮。
网格图像:
这是我的代码:
$(function() {
$("#grid").kendoGrid({
dataSource: new kendo.data.DataSource({
data: [{ SystemName: "SysTest", SystemID: "789" }],
serverPaging: false,
serverSorting: false,
serverFiltering: false,
batch: true,
/*filter: { logic: 'and', filters: [] }, //set the default it is passed as a value
sort: [], //set the default it is passed as a value */
schema: {
//data: "Items",
model: {
id: "SystemID",
fields: {
SystemName: { editable: true, nullable: true, type: "string" },
SystemID: { editable: false, nullable: false },
}
}
}
}),
columns: [
{
field: "SystemName",
title: "Some Name",
horizontalAlign: "left",
headerAttributes: { style: "text-align: left; width: 75%;" },
width: '45%',
encoded: false,
name: "SystemName"
}, {
field: "SystemID",
title: "SystemID",
horizontalAlign: "left",
headerAttributes: { style: "text-align: left; width: 75%;" },
width: '25%',
encoded: false,
name: "SystemID"
},
{
command: [{
name: "edit",
text: {
edit: "Edit", // This is the localization for Edit button
update: "Save", // This is the localization for Update button
cancel: "Cancel" // This is the localization for Cancel button
}
}], title: " ", width: "50%"
}],
editable: "inline",
sortable: false,
resizable: true,
autoBind: true,
navigateHierarchyCell: true,
persistSelections: true,
pageable: false,
autoResizeHeight: false
}).data('kendoGrid');
});
这是我的答案 -
change: function (e) {
$(".k-grid-update").show();
}