Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
How to determine row "level" client side
posted

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");

}

Parents
  • 33839
    Verified Answer
    posted

    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

Reply Children
No Data