Reordering columns only when in mobile view.
Reordering columns only when in mobile view.
dasherzx
Posts: 2Questions: 1Answers: 0
Hi, i have a table with a,b,c,d,e columns in their respective order.
However, in mobile responsive view I'm required to only show a,d while b,c,e will be shown after clicking on the "+" button as usual. The way i see it is to remake the table and use colreorder when mobile is detected.
Or is there any other better way using the responsive and colreorder plugin?
Thank you.
This discussion has been closed.
Answers
You can tell Responsive which columns you want removed.
https://datatables.net/extensions/responsive/priority
You can also
responsive.breakpoints
for fine tuning - see example here: http://live.datatables.net/zoniquvo/1/editColin
Hi, thank you for the responses. but i realized that i missed out on an important kicker. in mobile responsive view i'm required to show in the order of a,d,c while b,e shows up on the + button. basically, the ordering in mobile view is swapped as well. apologies for missing that out.
That would be possible, but you would also need ColReorder. You would listen for an event to say the screen has changed size,
responsive-resize
, and depending on your logic, you then move the columns withcolReorder.move()
.Colin