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
270
Delete all rows from WebHierarchicalGrid(client side)
posted

Hi,

My following javascript code is able to delete only last row in the Grid. Can you please let me know what's the issue?

<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" Height="350px" >
<Behaviors>
<ig:EditingCore>
<Behaviors>
   <ig:RowDeleting />
</Behaviors>
   </ig:EditingCore>
</Behaviors>

 

<input type="button" name="name" value="Delete All Rows(Client Side)" onclick="DeleteAllRows();" />

function DeleteAllRows() {
    var grid = $find("<%=WebHierarchicalDataGrid1.ClientID %>");
    var parentGrid = grid.get_gridView();
    var gridRows = parentGrid.get_rows();
    var rowLength = gridRows.get_length();
    var i = 0;
    for (i = rowLength - 1; i > 0; i--) {
        var row=gridRows.get_row(i);
        gridRows.remove(row);
        }
}

Thanks

Vin