TreeGrid open folder on double click

Hi, I’m wondering if it is possible to have a folder in a TreeGrid open when the text is double clicked and not just when the + symbol is clicked.



Your help is appreciated!


Hello,


you can use onEditCell event handler. For example:


grid.attachEvent(“onEditCell”,function(stage,id,index){
if(index ==0){ /for tree in the1st column/
grid.openItem(id)
return false
}
return true
})






Hi,

Thanks for the help with this.

The code you provided did open folders on double click, however on double clicking, the cell text was wiped. I tried changing code to the following:

treegrid.attachEvent(“onEditCell”,function(stage,id,index){
 if(index ==0){
  treegrid.openItem(id)
  return true
 }
 return true
})

This left the cell text intact. The only problem I have now is that when you reach the bottom level folder, if the text is double clicked, it is editable. If I use the command   treegrid.setEditable(“no”);   the above code will not work. I need the last stage of the folders to be read-only. Can you suggest a way that this can be achieved?

Thanks

You can use “onRowDblClicked” event to define when necessary cell was double clicked.
grid.attachEvent(“onRowDblClicked”, function(rId,cInd){
if (cInd==0){
grid.openItem(id)
return false
}
return true
});

Hi, that worked perfectly although there was a slight error in the code you provided. The correct code for anyone else wishing to do this is:

 grid.attachEvent(“onRowDblClicked”, function(rId,cInd){
      if (cInd==0){
      grid.openItem(rId)
      return false
      }
     return true
});

Many thanks