How to get the selected Row values in the Tree

The selected element id can be get as
    dhtmlxTree
       var id = tree.getSelectedItemId();
    dhtmlxGrid
       var id = grid.getSelectedRowId();

The value of element can be get as
    dhtmlxtree
        var val = tree.getItemText(id);
    dhtmlxgrid
       var val = grid.cells(id,index).getValue(); // index - index of column