Delete row/rows from any level in WebHierarchicalDataGrid

[Infragistics] Radoslav Minchev / Wednesday, February 16, 2011

Hello All,

I hope the function below will be useful in scenarios that require deletion of rows from WHDG. The function  shows how to delete row from any level of WebHierarchicalDataGrid. We have used it in varies samples :

<script type="text/javascript">
        function DeleteRow() {
            var grid = $find('<%= Me.WebHierarchicalDataGrid1.ClientID %>');
            var selection = grid.get_gridView().get_behaviors().get_selection();
            /* these will be the selected rows accross all grids, this is an array, but since u have
            single selection it should be an array of one row */

            var selectedRows = selection.get_selectedRowsResolved();
            for (var i = 0; i < selectedRows.length; i++) {
                var row = selectedRows[i];
                var containerGrid = row.get_grid();
                var gridRows = containerGrid.get_rows();
                gridRows.remove(row);
            }
        }
    </script>