Drag and Drop Functionality
Drag and Drop Functionality
Hello,
is there any way to drag multiple columns and drop at their new position.
We have one functionality where user can open one dialog which has all the columns listed.
Then user can re-arrange the columns in that dialog and click on 'ok' button. Once 'ok' button is click, datatable should get arrange as per column position which he/she has set in prior dialog.
Can this be achieved using colreorder lib or any other ways is possible?
Thanking in advance.
This question has an accepted answers - jump to answer
Answers
We have an extension called ColReorder that allows single columns to be dragged and dropped - see here: https://datatables.net/extensions/colreorder/examples/initialisation/simple.html
It won't do multiple columns, but hopefully it'll solve your problem,
Colin
Thanks for your reply, I have used ColReorder and it works well for normal re-ordering of column. However I could not achieve my problem statement with it.
Here I want to store re-ordered columns and on one click I need to re-order all my columns. Any way to achieve this behavior?
ColReorder has an API - that allows you to programmatically re-order multiple columns with
colReorder.order()
, or individually withcolReorder.move()
. You could perhaps plumb that into your drop-down,Colin