Opening a subtree by means of a function

Hi,



I’m having trouble opening a subtree in a treegrid by means of a function.



The definition of my grid is the following: mygrid.setColTypes("tree,stree,…

I want the subtree to open by a function which I can put in a button.



Is it also possible to get the selected value or id from the subtree, run it through a function and replace the value in the grid by the value resulting from the function? In other words is it possible to put a value in the subtree cell that is not a value in the subtree?



kind regards,

Arno.


>>The definition of my grid is the following: mygrid.setColTypes("tree,stree,… I want the subtree to open by a function which I can put in a button.


Open






function openSubTree(){
mygrid.selectCell(rowId,cellInd);
mygrid.editCell();
}
>>Is it also possible to get the selected value or id from the subtree, run it through a function and replace the value in the grid by the value resulting from the function? In other words is it possible to put a value in the subtree cell that is not a value in the subtree?



When subTree opens “onEditCell” event fires. So you can use it to manipulate with subTree:


mygrid.attachEvent(“onEditCell”,doOnEditCell);





function doOnEditCell(stage,rowId,cellInd,newValue,oldValue){
if ((stage==1)&&(cellInd==2)){
var selectedId=tree.getSelectedItemId();
var selectedText=tree.getSelectedItemText();
tree.setItemText(selectedId,“newValue”,“newTooltip”);
}
return true;
}