Hello,
I have a grid with the following features:
- Paging- Selection- RowSelectors
On the first page I select all rows then I click on my "Clear Selection" button ($('#grid1').igGridSelection('clearSelection');).Selection appears empty but when I go to page 2 then come back on page 1, all rows are selected.
Please find an example in attachement.
Thanks for your help,
Olivier
If you call 'clearSelection' in a handler of the pageIndexChanged event, you'll basically disable the selection storing functionality of the RowSelectors, yes. Alternatively, you can raise a flag when rebind or clearSelection is called and then clear the selection on other pages, only if this flag is up.
Hope this helps!
Best regards,
Stamen Stoychev
I have to provide a checkbox for each row. When the user rebind the grid (by clicking on a button) the selection must cleared.
What is the most appropriate? I tried to use the events PageIndexChanging and PageIndexChanged. Is this the right way?
Regards,
Clear Selection, similar to the rest of the Selection API works on the current page only. Your selection state is stored and reapplied when changing the page index because RowSelectors are initialized with the checkbox feature enabled. One of the functions of the RowSelectors checkboxes is to store and reapply selection after Paging.
With this said, the easiest way to disable the automatic selection storage is by simply disabling the RowSelectors checkboxes. If you, however, need the checkboxes enabled, I'll provide you with a custom solution that will clear the internal selection cache stored by the RowSelectors when you call "clearSelection". Please let me know if disabling the checkboxes is not a desired solution!
Ok it works! But with paging, "clear" only works on the current page. Is it possible to clear the entire selection (not displayed pages) ?
Hello Olivier,
This issue has been resolved with the later versions. If you change your loader's scriptPath and cssPath to point to the latest service release like this:
$.ig.loader({ scriptPath: "http://cdn-na.infragistics.com/jquery/20121/latest/js/", cssPath: "http://cdn-na.infragistics.com/jquery/20121/latest/css/", resources: "igGrid.Filtering,igCombo,igGrid.*" });
Clear Selection will then work as expected.
Thank you for using the Infragistics forums!