close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Changing order of rows in a database

Thread began 8/08/2009 1:23 am by Carl | Last modified 1/29/2010 9:49 pm by troyd | 5698 views | 14 replies |

Carl

Changing order of rows in a database

Hi

Does anyone know a way of changing the order of rows in a database?

e.g.

item order item
1 item1
2 item2
3 item3
4 item4
5 item5

and I want to change the order so if you click a down arrow on item2 it changes the order of item2 to item order 3 and item3 to item order 4 etc.

Thanks in advance

Sign in to reply to this post

Jason ByrnesWebAssist

WebAssist does not have an extension to accomplish this.

Apparently, this functionality exists in the Adobe Developers Toolbox. However, Adobe no longer sells the developer toolbox.

Sign in to reply to this post

John LangerBeta Tester

Tom Muck has an extension that will do this.

Sort Repeat Region

It works like a dream.

Sign in to reply to this post

anonymous

I think Carl was looking for something similar, though, to the ADDT Ajax function that allows you to reorder the column arbitrarily, so each item has an up arrow and a down arrow beside it... you then move things where you like and then click save at the top. It then rewrites an "order weight" column and you can then sort query by that same order weight column.

While ADDT is a dying animal, that was one of the good things it had... I am going to try to port that functionality into a stand-alone extension that could work with data assist.

Sign in to reply to this post

troyd

Did you have any luck coming up with a way to do this? I have a customer who wants control of the order of his records. Not just ascending and descending. This arrow "weight" column feature sounds perfect.

Thanks,
TroyD

Sign in to reply to this post

anonymous

Troy,

I did find a way to do this but it is not a "quick fix" so to speak... in other words you would have to manually add it to each results/list page. The way I had a working model was to use jquery's draggable sortable widget and add a save function to that which would rewrite the order weight column. I need to go purchase a jquery documentation book to see if I can write some sort of function and script where it could be quickly deployed.

See this link here: drag-and-drop-reordering-of-database-fields-sortables-with-jquery/

You would need to make your table into a list and then apply the jquery ui to it to get the desired results.

Regards,

Brian

Sign in to reply to this post

troyd

Very nice. Looks like what I am looking for. First I need to figure out the table to list part, then I will try that tutorial.

Thanks,
TroyD

Sign in to reply to this post

anonymous

Troy,

The way to do it would be just to create an unordered list wrapped around the repeat region and the table overall... then put each row within a list but then style the list so they have no effect on look of the table. Then just set the jquery id correctly to handle the movement of the lists.

I will try to dig out the code I used when I did this... especially since I have another project I could use this on. I may even see if there is an improved way to do this (which is why I need to pick up that jquery development book) - cause I would like to just assign the jquery ui id straight to the table row (which should be ok in theory).

Brian

Sign in to reply to this post

anonymous

Troy,

Good news! I have successfully created a way to make DataAssist's Search Results table sortable through JQUERY and with a little bit of hand coding, it's pretty easy to create the mechanism to save the new order.

Better yet, it allows you to just drag them into any order - so it is much faster than the ADDT way where you had to go one at a time by clicking the arrows.

I will post a tutorial probably tomorrow... I gotta get some rest after working on this one all day.

Brian

Sign in to reply to this post

troyd

Brian,

That's awesome. Can't wait.
So this will allow two features then, if I understand correctly.

First, on the front end of the web site, this could be added has a interactive rearrange of the records by dragging them up and down? For example if someone wanted to compare two records and one was at the top and the other was at the bottom, they could drag that one up?

And secondly, (the solution I need the most at the moment), on the back-end within the CRUD interface, the records could be updated as having weight over the others, and then appear that way on the front end?

I was trying to figure out a column I could add to the table that would allow this manually. But I don't know how you could prevent duplicate numbers. So if there were 10 records with misc. numbers (not IDs) of 1,2,3... and you wanted number 5 at the top, you couldn't just change 5 to 1 because then you would have two number 1s. So I'm guessing this new method will update them down the line? Can't wait to find out.

Thanks,
TroyD

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...