There’s at least 2 places in the system I’m converting where this functionality would be very nice for users.
One is the list of insurances a patient has - the order is important (primary, secondary, etc), and the second is the list of diagnoses for the patient where the order is also important.
In the current system, the insurance list table just has a column called sequence and the user must manually enter in 1, 2, 3, etc for the order - and re-do that order if it changes. It works but it’s not the best user experience.
It’s worse (from a database normalization standpoint) for the diagnoses - we have a flat list of fields in the registration table - dx1, dx2, dx3, dx4, all the way up to dx12. It’s kludgy as you know what.
It would be awesome if we could have normal tables with the ability to drag-n-drop to set the order on these - but I’m not sure it’s possible. I’ve done some looking around and haven’t come up with anything.
there is this one: Drag & Drop – CUBA Platform but I think it does not apply to table entries.
What I did in the past in this scenario is to create two buttons in the table with “Arrow Up” and “Arrow Down” and under the hood change those numbers of the entries in the table. So the user does not directly need (nor is able to) change the “position” attribute.
Hmmm, that’s not a bad solution, and is used in other apps too so it shouldn’t feel too unfamiliar to users.
Is the behind-the-scenes stuff easy enough to figure out from examples/etc? (And especially redisplaying the table after every position change.)
It is not problematic.
For the arrow up button:
iterate over all items in the data container and decrease the value of the position field by one (except for the table selection). Then you increase the position value by one for all selected items.
For arrow down: the same operation with swapping + & -
The table has to be sorted by the position value - which triggers automatic reordering…
Hmmm, I think I’m missing something.
If we have 4 items numbered 1 2 3 4 and apply that routine clicking up arrow on #2, after step one we have 0 2 2 3, then after step two we have 0 3 2 3 unless you mean increase all of them including the ones not being clicked on in which case it would be 1 3 3 4 - still incorrect.