columnReorder not working
columnReorder not working
gib65
Posts: 29Questions: 13Answers: 0
hello,
I'm experimenting with the columnReorder property on the DataTable and it doesn't seem to be working.
First, I may have the wrong assumption: I'm assuming columnReorder: true, will allow the user to reorder the columns by dragging and dropping them. Is this true? If not, how can I achieve that effect? Otherwise, please have a look at my code and let me know if I'm doing anything wrong:
[code]
column 1 | column 2 |
---|---|
Row 1 Data 1 | Row 1 Data 2 |
Row 2 Data 1 | Row 2 Data 2 |
Row 2 Data 1 | Row 2 Data 2 |
Row 2 Data 1 | Row 2 Data 2 |
Row 2 Data 1 | Row 2 Data 2 |
Row 2 Data 1 | Row 2 Data 2 |
Row 2 Data 1 | Row 2 Data 2 |
[/code]
Thanks.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Did you install the ColReorder JS and CSS?
https://datatables.net/download/release#ColReorder
Also the init option is
colReorder: true
notcolumnReoder
.Kevin
Thanks for the reply Kevin,
I now have references to the ColReorder JS and CSS, but it's still not working.
I got the example of columnReorder from here:
https://datatables.net/reference/event/column-reorder
Perhaps that's an old example?
I'm not sure about that particular example but the Column Reorder docs can be found under Extension, here:
https://datatables.net/extensions/colreorder/
These docs use
colReorder
to initialize column reorder.Kevin
Very good point - that's a typo in the documentation i"m sorry to say. Fixed here and I'll push it out to the site shortly.
Regards,
Allan
Thanks Allan,
I made the example I'm playing with available here:
http://www.shahspace.com/jquerydatatable/
I have this for making the columns reorderable:
$("#JQuery_DataTable").DataTable({
paging: false,scrollX: true,
scrollY: 300,colReorder: true
});Can anybody see why the columns can't be reordered?
Looks like you still need to use the colReorder plugin code:
https://datatables.net/download/release#ColReorder
Kevin
Oh yes, I see that I missed that.
I added them and it now works.
Thanks again everyone.