auto selecting in simple edit mode when addrow() to TreeGrid


I have code that adds a new row to a treegrid (tree, ro, ro). I want to auto select the first cell in the new row and it in edit mode with the text selected. How can I do that when the column type is “tree”? I’ve tried several methods, but nothing seem to work. Thanks in advance.

Basically the tree cell works in same way as other ones

    var id=some;
    grid.opentItem(id); //to be sure that row not in closed branch

Please beware that if you are using some button outside of grid the next may occur
    - click occurs
        - editCell called
            - cell switched to edit state
    - click event reachs document.body
        - grid detects click outside the grid
            - current active editor closed

To prevent such behaviour you may stop event propoganation

Thanks for the quick response. 

I tried your example and it selects the new node I added with no js errors, but it still doesn’t put the cell in “edit mode”, ready for the user to type in the name of the new node.  Anything missing?  Here’s my code for the control:

//event handlers

function hideRow(rowId)


if (mylistsgrid.getLevel(rowId) > 0)

mylistsgrid.setRowHidden(rowId, true);



mylistsgrid.openItem(rowId); //to be sure that row not in closed branch






//init and load

mylistsgrid = new dhtmlXGridObject(‘listgridview’);

mylistsgrid.setHeader(“”); //no header, but keep spacing


mylistsgrid.imgURL = “images/”;



mylistsgrid.enableEditEvents(false, true, true);






mylistsgrid.attachEvent(“onRowAdded”,hideRow); (257 Bytes)

Please check attached sample, after adding
to the onclick event - all works as expected - tree cell goes to edit state.

By the way, if you need to have a hidden header the correct way is
    mylistsgrid.setHeader(“A,B,C”); //no header, but keep spacing

The new node does get put into “Edit Mode” with a button, but the text isn’t highlighted. 

I am triggering this from a toolbar.setOnClickHandler function and not a button.  I’ve tried the cancelBubble in the function that the handler calls but no edit mode when using the toolbar.  Can I attach an “onclick” event to your toolbar?

but the text isn’t highlighted
    The cells of grid doesn’t highlight their value on selection, you can add next code to force cell value selection, but it will not work for all types of columns;

>>Can I attach an “onclick” event to your toolbar?
    You can block all events on toolbar level as
    var container=document.getElementById(“toolbar”);
    var z=new dhtmlXToolbarObject(container,…
    container.onclick=function(e){ (e||event).cancelBubble=true; };