Hi all,
I need to do some backend tasks when the user clicks the 'Select All'-Checkbox at the top of my grid. I followed this approach and it works fine: http://www.telerik.com/community/forums/aspnet-ajax/grid/gridclientselectcolumn-select-all.aspx#1469954
In the backend I then select ALL documents on ALL pages. I go to page 2 and all documents are selected as expected. But then I want to deselect all, and this does not work, because the deselect-click is not recognized on first try. Then you have to select all again and then deselect, on the second try it works fine.
I think the problem is caused by the auto-checked 'Select all'-Checkbox if all docs on current page are selected:
- I'm on page 1.
- I click 'Select all'.
- Handler is fired. In the backend I mark all documents as selected.
- I switch to page 2. All documents are selected as expected. BUT also the 'Select all'-Button in the Header is checked.
- I unselect the 'Select all' Button on the header, but the handler is not fired.
- I select the 'Select all' button on the header, now the hanlder is fired and all docs on all pages are marked as selected.
- I unselect the 'Select all' Button on the header and now the handler is fired, deselecting all docs on all pages.
So the problem is in step 5. I guess this is because by default the 'Select all' is not checked, but after all docs are displayed and the grid notices that all are checked, the 'Select all' is also checked automatically, but without notifying the backend handler. So when I uncheck the 'Select all' checkbox (step 5), the handler does not fire because the checkbox is 'still unchecked' (as the backend did not know that the grid checked the 'select all' checkbox in the meantime).
Might this be the reason? And if so, is there a workaround somehow? For example by disabling the 'Select all' checkbox to be checked if all docs on the page are checked? I've read in another posting that this is the expected behaviour but maybe there is chance to remote it?
Many thanks in advance!