-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
SearchKit - Add drag-sortable weight functionality #22081
Conversation
(Standard links)
|
I like the idea - have definitely had the experience of clicking 800 times to reorder a list. But am running into a few issues.
This is the search: It does save on the test site here.
|
Just looping back on this: You can ignore number 1. It helps if you run civi upgrades on the correct site. (Problem was You can ignore number 2. I was confused. So just number 3, with an additional comment that the current screen's buttons for "move to top" and "move to bottom" are often convenient whereas dragging an entry across a long list that scrolls off-screen is less convenient. So it would be nice to keep those two shortcuts. |
@demeritcowboy belated thanks for the review. I incorrectly assumed that the BAO was handling weight adjustments, but it turns out to have been implemented at the quickform layer, so I'm going to have to add it to APIv4. PR for that incoming. I also wasn't happy with the ajax saving mechanics, so have added another PR to improve that: #22125 - will rebase this PR once that one is merged. I'm a bit stumped about how to do both drag-n-drop and "move to top/bottom" buttons in the same UI. Maybe we can just get the drag-n-drop working for now and ponder the other. |
Ok thanks will take a look. |
Thanks @demeritcowboy - here is the other promised PR to add the weight-adjustment functionality: #22137 |
53f2239
to
6bd1017
Compare
@demeritcowboy all the prerequisites for this have been merged :) |
jenkins retest this please (checking since patch doesn't apply locally for me) |
Drag-sortable weights are similar to in-place edit in that it uses the API to update records in the table. In this case it updates the "weight" column when the user drags a row into a different position.
6bd1017
to
488560c
Compare
@demeritcowboy rebased. |
I tried this out again and it looks pretty good. A good technique for dragging over long lists seems to be to add the Order field to the display, then check the box for in-place edit. Then you can quickly move a row to the nth row. Now just needs an undo feature...(grin) |
Overview
Allows SearchKit table displays to be drag-sortable.
Before
This is with an eye toward replacing those godawful tables in core that look like this:
After
To recreate that table without the awfulness, create a search display and enable the new "Drag and drop sorting" option (this is only available for entities with a "weight" column).
And the result will be a sortable table:
Technical Details
Drag-sortable weights are similar to in-place edit in that it uses the API to update records in the table. In this case it updates the "weight" column when the user drags a row into a different position.