• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ordering of list thru Top and down arrow

 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

What I have is a list of employees with radio button infront of them and a top and down arrow at the top and bottom of the list. what i wanted is suppose a user selects the radio button infront of the third employee and click on the top button. then the thrid employee name should move to the second position. How can it be done thru javascript.

Thanks,
Rahul Juneja
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The easy solution would be to use the up down selction code here, but that is not what you are looking for.
http://www.mattkruse.com/javascript/selectbox/

I am not going to write it, but basically you need to have an array with all of the names. You need to dynamically write the array's elements to the page using innerHTML of a layer. Each time a button is click you need to determine which radio button is selected. by looking at the radio button array. You then need to switch the two items based on what button was clicked.

Problem is, when the person comes back to the page they will be back to the default order.

Eric
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, I have to wait til they figure out an error to do my testing at work so I got this done in a two minutes:

http://www10.brinkster.com/a1ien51/JavaRanch/moveList.html

Eric
 
reply
    Bookmark Topic Watch Topic
  • New Topic