6

I'm wondering if there is a good library or script out there that trivializes drag and drop functionality for table rows in Javascript? Really the only requirement I have is that rows must be draggable within the table itself, but also to other tables on the page. I'm not too familiar with JQuery or Javascript itself, so I'd like to try and find a self contained library or script that makes the drag and drop portion pretty simple so I don't have to write the code myself. I understand JQuery is a nice Javascript library, does it have this kind of functionality?

4 Answers 4

7

JQuery UI does it for you. Create table with tbody and thead tags. Then set for tbody the some id and use jquery ui:

$( "#table_tbody" ).sortable();
$( "#table_tbody" ).disableSelection();

Here is what you need, I edited example in a link as in Bob's answer, but for tables: Table example And code view: code view

Sign up to request clarification or add additional context in comments.

1 Comment

What if I want to drag a column not a row?
5

How's this for ya?

http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/

2 Comments

I saw that one but unfortunately it doesn't support dragging and dropping from one table to another, which is one of my requirements.
One comment on the isocra implementation. It supports only simple drag and drop elements. If your row contains the entire image, it will not work.
2

Sounds like you want jQuery UI and the Sortable Connects demo

2 Comments

This looks like it might be what I need. I'll give it a try, thanks!
Wait, i just read this doesn't work with table rows, only lists and divs.
0

Most well known javascript libraries available today have a drag & drop functionality.

You could give a try to:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.