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
30
Detecting if a WebDataGrid Row is selected on client-side
posted

I've got a WebDataGrid set up and it's calling a simple client-side function that triggers a postback:

 

function WebDataGrid1_RowSelectionChanged(webDataGrid, evntArgs)
    {        
    __doPostBack('<%= WebDataGrid1.ClientID %>', '');  

    }

However I only want this postback triggered when a row is selected. My problem is that I have filtering enabled, and whenever the filter row is selected this causes a postback, which makes it impossible to use the filter row.

I think this could be solved if i added an if statement that checked if the number of rows selected is > 0 or if the selected row is the filter row.

 

I think I've figured out how to access the selected rows with

grid.get_behaviors().get_selection().get_selectedRows()

but then I get stuck. I can't seem to find any documentation on how to check for existance of rows/check for selection of filtered rows.

Parents
  • 33839
    posted

    Mr. Nova,

    If you are accessing the selected rows collection, you could simply get the length of that collection using get_length().  If it is 0, then no rows are selected.  You can also get a reference to the filter row and the do indexOf(filtRow) off the selected rows collection.  That should return -1.  The filter row can be found using webDataGrid.get_behaviors().get_filtering()._row

    This should help you.

    regards,
    Dave Young

Reply Children
No Data