handler for row click

how to handle such events?

grid.attachEvent(“onRowSelect”, function(id){
alert(id);
});

docs.dhtmlx.com/doku.php?id=dhtmlxgrid:events

Does this work for the treegrid?

Yep, all events and api method of grid can be used in treegrid.