Buttons Colvis with ColReorder

Buttons Colvis with ColReorder

stianbaystianbay Posts: 3Questions: 1Answers: 0

Hello.

It looks like the column visibility functionality in the Buttons extension breaks if I reorder my columns. I have a pretty custom setup so it might be something else that's causing it.

What I am seeing is that the correct column is being hidden from the table but the list of all the availible columns is not updated so where the new coulmn would be it shows that this other column was hidden instead (which it didnt). This also results in the buttonApi.active() param always becomes true even though the buttonApi.text() is still correct. Abit hard to explain but here is a screenshot to illustrate it.

http://i.imgur.com/AakhpDn.png
1. No columns have been reordered and the "Sendt" column is clicked to hide it.
2. Columns get's correctly hidden and marked hidden in the list as hidden.
3. Column is shown again and dragged 4 columns to the right. The list is now showing the "Sendt" column on the wrong place. It's not a huge issue that this doesn't get updated on colreorder.
4. When the "Sendt" column is clicked and I want to hide it, the column is correctly hidden in the table, but the wrong column is marked hidden in the list and the params for buttonApi.active() when "Sendt" is click is always true. This also breaks alot of other functionality when a column is hidden. All the columns between the column that was moved and to the current column experience the same problems.

Any suggestions is greatly appreciated.
Thank you
//Stian

This question has an accepted answers - jump to answer

Answers

  • jr42.gordonjr42.gordon Posts: 305Questions: 2Answers: 49

    Please make sure you are using the latest version of DataTables. This was a recent bug, within the last week or so, that was fixed by Allan. Try it and let us know result.

    Thank you for the image and included test results.

  • stianbaystianbay Posts: 3Questions: 1Answers: 0
    edited June 2016

    Ah ok. Yes, I updated all the plugins i use to latest.
    For reference:
    datatables.net 1.10.12
    datatables.net-bs 1.10.12
    datatables.net-buttons 1.2.1
    datatables.net-colreorder 1.3.2
    datatables.net-responsive 2.0.0 (custom)

    I tested modififying the original code a little bit and I noticed that in the colvisRestore section there is a section with the comment //Take into account that ColReorder might have disrupted our indexes. This is not however beeing called and from what I can see there is some problems in the columnVisibility secton.

    I feel like its taking the wrong index and not the actual colIndex from the dt.colReorder.order() object. This results in the list beeing populated wrong and therefore the click methods on the buttons is not working correctly

  • allanallan Posts: 63,803Questions: 1Answers: 10,515 Site admin
    Answer ✓

    There is a bug with ColReorder and Button's column visibility controls in the current release I'm afraid. Its already been fixed and is in the nightly. It will be included in the next release of Buttons.

    Allan

  • stianbaystianbay Posts: 3Questions: 1Answers: 0

    Awesome. Thanks! That fixed it right away \o/

This discussion has been closed.