fix for a bug with reorder and colVis extension

fix for a bug with reorder and colVis extension

M_ModeM_Mode Posts: 4Questions: 0Answers: 0

Hello,

there is a problem if you use the reorder and buttons (colVis) extension together.
See here: https://datatables.net/extensions/colreorder/examples/integration/colvis.html

  1. Hide the position column
  2. Move age on the first position
  3. Show the position column again
  4. Hide the position column.

  5. Now you see, the class 'active' is removed from the wrong button (here it is office).

To fix this, i have changed buttons.colVis.js (line 64)

a.on("column-visibility.dt" + c.namespace, function(a, b) {
                    b.bDestroying || f.active(d.visible())

to

 a.on("column-visibility.dt" + c.namespace, function(h, b) {
                    b.bDestroying || f.active(d.visible())
                    g = a.column(c.columns);
                    f.active(g.visible());

I know, it's not nice, but it works for now. I think you can make a better fix.

This discussion has been closed.