在Kendo Grid-“编辑”选项中,如何隐藏/显示“保存”按钮如果没有更改或某些更改,则显示

时间:2019-02-20 01:51:03

标签: jquery kendo-ui kendo-ui-grid

能否让我知道如何根据用户是否对“编辑”文本框进行了某些更改来隐藏/显示“保存”按钮,例如,如果未对编辑文本框进行任何更改,则我们应该隐藏“保存”按钮。如果用户对“编辑”文本框进行了任何更改,则应显示“保存”按钮。

网格图像:

Grid Image

这是我的代码:

 $(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');
    });

1 个答案:

答案 0 :(得分:0)

这是我的答案-

change: function (e) {
                                $(".k-grid-update").show();
}