Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Kendo Grid be always in edit mode?

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 want it the widgets to be displayed and available at all times.

Is it possible at all?

like image 703
ThiagoPXP Avatar asked Aug 19 '13 00:08

ThiagoPXP


2 Answers

Out of the box, not exactly. You can enable Batch editing which displays everything normally, but clicking a cell will switch it to an editor automatically.

Example

To enable it, set { batch: true } on the table's datasource. Otherwise you're off to some deeper scripting. Checked and simply calling editRow on all rows doesn't do it. Default behavior is to disable editing on a row when a new one is taken into edit mode.

So, quick look says Batch mode - won't display editors all the time, but works and out of the box.

like image 94
Leniency Avatar answered Sep 19 '22 13:09

Leniency


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: "<input data-bind='value: age' data-role='numerictextbox'>" },
    { field: "name", template:"<input data-bind='value: name' >" }
  ],
  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

like image 36
Atanas Korchev Avatar answered Sep 21 '22 13:09

Atanas Korchev