Leave a gap of 10 or so between
priorities to allow reordering, etc?
That would be my inclination. Except perhaps making the gap even larger than 10. Derive the gap between rows prior to inserting a new row. Then make the new row "priority" value 1/2 the derived gap.
Of course, after so many inserts you could reach a point where the gap between rows was only 1. So you might have to supplement your routine with something that reorders the whole list before being able to insert a new row between rows.
-Nathan
----- Original Message -----
From: "Holm, Paul" <pholm@xxxxxxxxxxxxxxxxx>
To: web400@xxxxxxxxxxxx
Cc:
Sent: Monday, April 29, 2013 10:42 AM
Subject: [WEB400] Pattern to Reorder Records via Drag and Drop
Looking for insight/experience on the following:
We have many scenarios where a list of records (subfiles) are presented to
the
user. In the record that is a field that holds an INTEGER representing
"relative order" of that
record compared to the others. We are looking to create a flexible
approach that can allow reordering of the records. One specific example
is:
We have a web page that has a list of ORDERS to be processed. Each ORDER
has a PRIORITY field. Orders with the highest priority get worked on 1st.
A Priority of 99 1st then priority 88, etc. The Order Manager based on
several factors such product type, customer importance, labor schedules,
etc has the ability to change the relative ORDER that ORDERS should
be fulfilled. We are looking to enable this via JQUERY sortable. Manager
will drag the most important ORDER to the top of the list and drop it. As
a result of this, we need to change the DB2 value of the PRIORITY field to
be large than any other in the list.
What are the best practices In terms of setting up the priority field to
allow easy swapping of Priorities. Leave a gap of 10 or so between
priorities to allow reordering, etc? Big things seems to the the PRIORITY
value intervals and the methodology to swap numbers.
Thanks in advance,
Paul Holm
www.planetjavainc.com
As an Amazon Associate we earn from qualifying purchases.