javascriptdojodojox.grid.datagriddojox.grid

Dojo EnhancedGrid: How can I make particular cell editable not the entire column


Lets say Grid has 10 rows and I want to make Cell (9th row of col2 field) editable. Could you please give me any solution for this?

Here is my Grid

var grid = new dojox.grid.EnhancedGrid({
    store: store,
    autoWidth: true,
    structure: [
        { name: "Number", field: "col1", width: "84px", editable: false},
        { name: "Description", field: "col2", width: "84px", editable: false },
        { name: "Stock", field: "col3", width: "84px", editable: false }
    ]
}, "grid");

Solution

  • try using canEdit function as below. Below example shows how not to make first cell non-editable.

    var grid = new dojox.grid.EnhancedGrid({
        store: store,
        autoWidth: true,
        structure: [
            { name: "Number", field: "col1", width: "84px", editable: false},
            { name: "Description", field: "col2", width: "84px", editable: false },
            { name: "Stock", field: "col3", width: "84px", editable: false }
        ],
     canEdit: function (inCell, inRowIndex) {
                if (inRowIndex && inCell.index === 0) {
                    return false;
                }
                return this._canEdit;
            }
    }, "grid");