Can Kendo Grid be always in edit mode?

前端 未结 3 2060
悲哀的现实
悲哀的现实 2021-02-20 07:52

Does anyone know if the kendo grid could be always set to edit mode at all times?

We don\'t want the user to click on a cell or a button to activate the edit mode. We w

3条回答
  •  感动是毒
    2021-02-20 08:27

    Apart from using batch editing mode you can try setting the template of every column and binding the input elements to the data items using MVVM.

    $("#grid").kendoGrid({
      dataSource: {
        schema: {
          model: {
            id: "id",
            fields: {
              id: { editable: false }
            }
          }
        }
        data: [
          { id:1, age: 30, name: "John Doe" }
        ]
      },
      columns: [
        { field: "id", width: 50 },
        { field: "age", template: "" },
        { field: "name", template:"" }
      ],
      dataBound: function() {
        var rows = this.tbody.children();
        var dataItems = this.dataSource.view();
        for (var i = 0; i < dataItems.length; i++)  {
          kendo.bind(rows[i], dataItems[i]);
        }
      }
    });
    

    Here is a live demo: http://jsbin.com/ApoFobA/2/edit

提交回复
热议问题