Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Trupti on Aug 04, 2009 04:19
open dhtmlx forum
dhtmlXtreeGrid

Hi,

I would like to know if i can make cells in column of type "tree" in a tree grid as non-editable?

mygrid.setColTypes("tree,ro,ro");

The first column type is marked as "tree" but at the sametime i would also want some of the cells in the column to be non-editable. If i make the column type as "ro" then the tree is not displayed in column. How do i make the column type as "tree" as well as make some of the cells in the column as read-only?

Thanks,
Trupti
Answer posted by dhxSupport on Aug 04, 2009 05:19
To make "tree" cell not editable you can add following line to the treeGrid init:
mygrid.enableTreeCellEdit(false)
Answer posted by Trupti on Aug 04, 2009 05:27

Thanks a lot for such a prompt reply.

I implemented your suggestion, but this makes all the nodes in the tree as non-editable. My requirement is to make some of the nodes in the tree as read-only while i should still to able to edit remaining nodes in the tree.

Thanks,

Trupti

Answer posted by dhxSupport on Aug 04, 2009 05:52
You can disable editor of the necessary cell with setDisabled(true) method:
mygrid.cellByInd(rowId,cellIndex).setDisabled(true)

Answer posted by Trupti on Aug 04, 2009 06:43

Hi,

I tried using :

mygrid.cellByIndex(0,0).setDisabled(true);

But this does not make the cell un-editable, the first cell in the grid still remain editable.

Following code snippet is used bye me:

  mygrid = new dhtmlXGridObject('gridbox');
  mygrid.selMultiRows = true;
  mygrid.imgURL = "./images/";
  mygrid.setHeader("Name,Status,Owner,Version,Last Modified");
  mygrid.setInitWidths("550,70,70,70,90")
  mygrid.setColAlign("left,left,left,left,center")
  mygrid.setColTypes("tree,ro,ro,ro,ro");
  mygrid.setColSorting("str,str,str,str,str")
  mygrid.enableAutoHeigth(true);
  mygrid.setSkin("xp");
  mygrid.enableTreeGridLines();
  mygrid.enableMultiselect(true);
  mygrid.init();
  mygrid.loadXML("rma_grid_data.xml");
  debugger;
  mygrid.cellByIndex(0,0).setDisabled(true);

Please let me know if i am making some mistake in using the setDisabled() method.


  

Thanks,

Trupti

Answer posted by dhxSupport on Aug 05, 2009 01:32
cellByIndex() method should be called only after necessary cell was loaded:
  mygrid.loadXML("rma_grid_data.xml",function(){
       mygrid.cellByIndex(0,0).setDisabled(true);
  });
  

Answer posted by Trupti on Aug 05, 2009 01:40

I tried the above piece of code, but it isn't working for me.

Thanks,

Trupti