Question about selectPage checkbox behavior
Question about selectPage checkbox behavior
kthorngren
Posts: 21,450Questions: 26Answers: 4,975
See the Current page selection only example and follow these steps:
- Click Select All to select all on the page
- Go to page two and select a row
- There are 11 rows selected and the intermediate state is shown
- Go back to page 1 and click Select All
- Nothing happens - I expected all selected rows to become unselected
What is the expected behavior?
Kevin
Replies
Yeah, there's something very odd there. I'd say when you Select All on page 1, when you go to any other page, all rows should still be selected. As it stands, those other selections are being cleared - it's not just a display issue, as
rows()
agrees with it too:II've raised it internally (DD-2979 for my reference) and we'll report back here when there's an update. I'll add a unit test for this too, it looks like it was missed,
Cheers,
Colin
Hmmm - the header checkbox is configured to operate only on the page, so yes, I guess it should deselect the current page if all rows are selected on it. Following through on that, it should show as checked when all rows on the current page are selected. However, the state of the checkbox at the moment is only based on all rows, across all pages.
I don't really like the header checkbox state being based on the current page only - that doesn't seem to make much sense, but it is how it is configured...
For a configuration value of
select-page
the current behaviour could be argued to be correct (select page, status global), but a value ofpage
could be used for the current page control only.What a horrible set of edge cases that one little option introduces!
Allan
This test case shows how the Gyrocode checkboxes handles select all on current page only.
https://live.datatables.net/tilarisu/1/edit
Looks like it keeps the header checkbox status on a per page basis.
Kevin
Nice example - many thanks Kevin! I think that probably makes most sense given the option in question. I'll look at getting that done when DT 2.1 is finished.
Allan
Sorry, Kevin, totally ignore my comment above - I missed the point that your comment (and the example) were demonstrating single page selection. I must stop replying to forum posts until the coffee has kicked in...
No worries. I misinterpret questions quite often when I haven't had my coffee
Kevin
Quick note to say that I've committed a fix for this issue. It will be in Select 2.1 which will drop shortly
Allan