[thelist] Dynamically switching TR order?

Jason Lustig jasonlustig at adelphia.net
Sun Jul 4 00:52:18 CDT 2004


So I'm writing a web app, and it has the ability to let you, say, 
specify the order of questions in the FAQ instead of just, say, sorting 
them alphabetically. I am working on the UI to let the user change the 
order of these questions, and I can easily have JS switch the hidden 
values of the "order key" (the numerical field in the DB that is how 
they are sorted so that they are displayed like the admins want them to be).

The only problem is, then, how to meaningfully display the proposed 
changes to the user before they submit them. Theoretically I could use 
disabled form items in which I switch text, but that is kludgey and 
unprofessional, besides being plain ugly, and also I would have to have 
it be a separate page from the listing, which is where I really would 
like them to be doing all this.

What I really would like to do is dynamically move table rows up and 
down, so that say for example I had this:

<table>
<tr><td>Row 1</td></tr>
<tr><td>Row 2</td></tr>
</table>

Then I could somehow have a JS function which would switch the rows when 
the user clicked a button, so that it would be displayed as if the code was:

<table>
<tr><td>Row 2</td></tr>
<tr><td>Row 1</td></tr>
</table>

Any ideas on how to solve this, or do it another way? By "do it another 
way", I mean, does anyone have another UI solution to the problem of how 
to let users change the order of something in a top-down fashion?

Thanks!

Jason


More information about the thelist mailing list