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.
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
Thanks, I forgot about get_length(). With that I don't even need to declare all those variables, this works just fine:function WebDataGrid1_RowSelectionChanged(webDataGrid, evntArgs) { if (evntArgs.getSelectedRows().get_length()>0) { __doPostBack('<%= WebDataGrid1.ClientID %>', ''); } }