Sortable: Using Sortable with table columns?

Created on 13 Sep 2017  路  2Comments  路  Source: SortableJS/Sortable

Hello,

Just wondering if you can give me an example of how I may implement this to drag/drop table columns with the below HTML structure?

Column 1 Column 2
Value 1 Value 2

Any advice much appreciated!!

Andy

question

All 2 comments

see below codepen:

https://codepen.io/jlapinski/pen/ZXYERN

this is one way you could achieve what you are looking for. Unfortunately, because of how HTML tables are structured (items are most commonly grouped by row), I don't think we can easily use Sortable to move columns around. My example groups by column with divs. It's ugly, but hopefully it's a useful starting point for you.

Hello @andy-hammond,

You can use the following code to drag and drop between two lists.
https://jsfiddle.net/wpplugindev/53vhp34e/22/

Actually, I am facing issue regarding its ordering and save its positions in DB.

Regards,
Abdullah
@wpplugindev

Was this page helpful?
0 / 5 - 0 ratings