Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Craeg Strong on Apr 26, 2009 22:35
open dhtmlx forum
How to make dhtmlxTreeGrid eXcell_tree read only variant

I am using dhtmlx Tree Grid v 2.1 on Firefox 3.0.9 on mac 10.5.6
I have a simple three column tree grid initialized as follows:

this.featuregrid.setColTypes("tree,ed,txt");

This works fine, but the first column with the expandable tree control contains an ID, and should not be editable in my app. I noticed the built-in eXcell_tree function is editable. I followed the documentation to create a read only variant:

this.featuregrid.setColTypes("ro_tree,ed,txt");
function eXcell_ro_tree(cell)
{
this.base = eXcell_tree;
this.base(cell);
this.edit = function() {}
}
eXcell_ro_tree.prototype = new eXcell_tree;

I get an error: this.grid._tgc is undefined, dhtmlxtreegrid.js line 416

Please help! What am I doing wrong?
Answer posted by dhxSupport on Apr 27, 2009 03:45

To make "tree" column uneditable you can use method mygrid.enableTreeCellEdit(false). Or you can return false in the "onEdicCell" event handler:

mygrid.attachEvent("onEditCell",function(stage,rowId,cellIndex){

if ((stage==1)&&(cellIndex==0)) return false; // if user will try to edit first column;

return true; 

})