Thanks jarry. That worked, but only for the first level. When I try it with the subsequent levels, while the row in question is selected, the parent row is not expanded. Here's what I've tried:
function refreshGrid(grid_id){
var grid = '#' + grid_id;
var row = $(grid).treegrid('getSelected');
if(row){
var grid_level = $(grid).treegrid('getLevel', row['id]'])
$(grid).treegrid('reload');
if (grid_level ==0){
$(grid).treegrid('scrollTo',row['id']);
$(grid).treegrid('selectRow',row['id']);
$(grid).treegrid('highlightRow',row['id']);
} else if (grid_level == 1){
// get the parrent node and id
var parentNode = $(grid).treegrid('getParent', row['id']);
var parent_id = parentNode['id'];
// scroll to the parent node, expand it and select the row.
$(grid).treegrid('scrollTo',parentNode['id']);
$(grid).treegrid('expand', parentNode['id']);
$(grid).treegrid('select', row['id']);
}
}
}
What happens is that the grid is reloaded, but the parent node is collapsed. When I expand it, the row in question is selected. I am not sure what the issue is in this case, so any help would be appreciated.