-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
States of GRID checkboxes aren't saved for further use #2081
Comments
This will lead to a hidden selection. This is not wanted nor standard. We do not want to allow selection (and actions) on non-displayed entities. The solution is however easy, use larger IPP (items per page) and optimionally narrow the entities by search. Am I right is issue is solely about persisting the selection? Across what? Grid reload? page reload? Search? -> please comment and edit the description a) to be shorter :), b) to narrow it's scope. |
More details on the issues: 1) Usability
I understand it's a matter of taste and learning / habits. Probably we can add an option to addSelected that keeps this flexible? 2) Persisting The Selection
Example:
Expected behaviour:
In my case I need to keep the state of checked checkboxes over a 4 step wizard. Example: 3) Save The Selection
4) Reset The SelectionA button to reset selection. If "$preserveSelectionOnAllPages == true;" just unsetting the variable that contains the selection. |
Steps to do:
|
This is legit point. IPP change should not reset the selection. Memorizing the selection across (whole) page load is however probably not wanted, as there can be multiple actions, so the memorized selection can be for another/previous action and can no longer make sense. Also I am strongly againts any hidden selection, so page (in sense of paginator) change should probably not hold the selection from another no longer visible page. API for setting an array of selection/getting the current selection might be good. What are your usecases? Maybe you might want to store the checkebox state within entity and use inline/in-cell edit. |
Not only that, what, if the max. selectable IPP is 100 and you have 115 entries. No chance to get that done in a user friendly way...
Probably yes. Although in some cases, it makes things easier. So we should be flexible (that's what I love about atk4: it's flexibility)...
I have a client who has 4.000 adspaces. To create offers for their clients, they want a list of adspaces that's filterable and searchable. When they believe, they are ready for the next step, they go to the next step in the wizard. It happens, that they miss an entry, so they go one step back to the list again, search for another adspace and add it to the selection. If the selection is reset every time they search, switch page or go to the next step, it would be a productivity and usability nightmare. And the other way: if they could just go seamlessly back and forth that would make things easy and user friendly (in this case). I hope you see my points now 😊 |
The issue
As per discussion on Discord, there's currently no implemented way of saving the state of checkboxes in a GRID. That means, you add checkboxes via "addSelection();", then you get checkboxes. That's it.
If you check some checkboxes and click on another page in paginator (below the grid), all selections get lost.
It's currently impossible to go through all items of a grid and make selections on several pages. Yes, you could increase the IPP, but that's not user friendly or convenient.
My current workaround is to call an AJAX file every time when a checkbox is clicked. I save the state of the checkbox in a session array then.
When the grid reloads, it reads the selected IDs from the session variable and pre-selects them.
That's working fine so far (code below) until it comes to pagination.
As soon as you click on another page, the selections get lost again (although the previously selected checkboxes are still in the session variable - so they still can be used, but aren't there visually which is bad for the UX).
(Partial) Workaround
Now let's discuss ways of how we can achieve the following:
I added the following method into my extended GRID:
use it like this:
The saveToSession.php looks like this:
This should be ment as a basis for discussion on how to implement the functionalities described above but in a more atk4 way.
Let's brainstorm first here and then do it.
I am happy to support and implement it, but I'm not so deep in atk4 core development, so I need your support / ideas on how to bring it into the atk4 core and create a pr please 🙏
The text was updated successfully, but these errors were encountered: