Colreorder and Column visibility integration

Colreorder and Column visibility integration

Sam34Sam34 Posts: 2Questions: 1Answers: 0

Update of list of columns not working anymore when column not visible

Hi,

I have a problem with coumn visibility integration with colreorder on my datatable page, and it seems to be the same in this datatables Column visibility integration example :
- everything is working as expected if all columns are visible
- but if one column is not visible (from the begining or after hiding it through column visibility button), then the update of the order of the list of the columns doesn't seem to work anymore after column drag and drop.
- More : the names of the columns in the list are not matching the right columns anymore (wrong column is hidden when checking it in the column visibility button).

Any help on this would be appreciated as for now I can't use these two great extensions together.

Thanks !

Answers

  • Sam34Sam34 Posts: 2Questions: 1Answers: 0

    Seems like this is a known issue.

    Issue is still open, but thanks to @Pepsi Dave comment on another similar issue, I can now make it work :

    var myTable = $("#myTable").DataTable({}).on('column-reorder', function () {
        initColReorderButtons();
    });
    
    var initColReorderButtons = function () {
        myTable.button(0).remove();
        myTable.button().add(0,
            {
                extend: 'colvis',
                columns: [':not(.noVisInButton)']
            });
    };
    
    setTimeout(initColReorderButtons(), 200); // I use this so that it still works on init with the saved state option
    
  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @Sam34 ,

    Sorry, yep, this is a known issue. It's already been raised internally (DD-698 for my reference) and we'll report back here when there's an update (the thread you linked to is also listed on that issue).

    Cheers,

    Colin

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    We will be releasing today, and this fix will be present.

    Cheers,

    Colin

This discussion has been closed.