Sort Order...

Results 1 to 2 of 2

Thread: Sort Order...

  1. #1
    Join Date
    Dec 1969

    Default Sort Order...

    Guys--<BR><BR>I have a page that allows a user to add/remove items from a list box; which when added to the list box a sort order is automatically applied...<BR><BR>What I&#039;d like to do allow the user to move an item up in the sort order...<BR><BR>The problem I&#039;ve run into is that let&#039;s say you have four items in the list box so it would look like...<BR><BR>item sortorder<BR>-- --<BR>item1 1<BR>item2 2<BR>item3 3<BR>item4 4<BR><BR>Now if I remove item three the list looks like<BR><BR>item sortorder<BR>-- --<BR>item1 1<BR>item2 2<BR>item4 4<BR><BR>Which is fine but now lets say I want to move item4 up in the list to make it move past item2 so that the list would then look like...<BR><BR>item sortorder<BR>-- --<BR>item1 1<BR>item4 2<BR>item2 4<BR><BR>Anyone have any ideas on how to do this..?

  2. #2
    Join Date
    Dec 1969

    Default Not quite the same thing, but... page on "Dual Lists in HTML" at <BR><BR>should give you the general idea.<BR><BR>There, I&#039;m transferring contents from one list to the other, but realistically you have to do nearly the same thing to reorder a single list. You have to *wipe out* the list from the point of change onwards and then rebuild it from that point.<BR><BR>So the easiest way is surely to say the heck with it and just completely wipe out the list and rebuild it from scratch every time.<BR><BR>So the best way to do this is probably to keep the option values and text in an array and, when asked to change the order, change them *in the array only*. Then wipe the &#060;SELECT&#062; list and rebuild it from the array contents, in order.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts