Niek Vandael
Niek Vandael

Reputation: 394

Dojo datagrid: set conditionally editable column (change at runtime)

Dojo datagrid/enhancedgrid v1.10:

Is it possible to change the class & editable-property at runtime? - rerendering the grid could also solve the problem.

http://jsfiddle.net/xDUpp/73/

function disable(){
    // Disable the columns: implement here    
        var mygrid = dijit.registry.byId("myGrid");

        for (var i = 0; i < mygrid.structure.length; i++) {
            var column = mygrid.structure[i];
            column.editable = false;
            column.classes = "";
        }

    mygrid.setStore(mygrid.store);

}

I have tried to reset the store, but it didn't work:

mygrid.setStore(mygrid.store);

Upvotes: 2

Views: 248

Answers (1)

L. Vandendriessche
L. Vandendriessche

Reputation: 140

You have to use something like this:

var theStructure = mygrid.structure;
    theStructure[0].editable = true;
    theStructure[0].classes = "editableCell";
    mygrid.setStructure(theStructure);

The complete solution can be found at:

http://jsfiddle.net/xDUpp/75/

Have fun with it!

Upvotes: 2

Related Questions