I need to be able to tell what level of the hierarchical data grid the row that was selected belongs to. The goal is to be able to use the information to show/hide other panels on the page. In somewhat pseudo code, below, is what I'm attempting.... on the server side I can get the value of the row islands DataMember property but I can't seem to find the equivalent client side. Anyone have any ideas?
var selectedRows = e.getSelectedRows();
if(selectedRows.getItem(0).get_rowIslands(0).datamember == 'sdsSAEvents_DefaultView'){
alert("found it");
}
Hi,
You could try using this code.
function level(row) { var level = 0; var parentRow = row.get_grid().get_parentRow(); while (parentRow != null) { level++; parentRow = parentRow.get_grid().get_parentRow(); } return level; }
Just pass in the row that you want the level of, in this case selectedRows.getItem(0). Bear in mind though that if you have two sibling bands on the second level, their 'level' will be the same even though the datamember could be different. Let us know if this code doesn't work for you.
regards,David Young
Yes, this works just fine. I was really hoping for something more elegant, such as a way to get the DataMember. Perhaps I'll submit it as an enhancement.
Thanks for your suggestion.