The some columns on the datatable are not draggable or are dragged to incorrect positions when the selectableRows is set to none and the table does not take up the full viewport width. Even if a column is draggable, it may lose the ability to be dragged after moved.
When selectableRows is set to none, the column drag should behave identically to other values of selectableRows.
SelectableRows is set to none and the table is an item in flexbox row.
Column drags may for for some columns but not others. After dragging, a column may also lose it's ability to be dragged.
https://codesandbox.io/s/interesting-blackburn-iv3mw?file=/examples/draggable-columns/index.js
Forked from demo sandbox.
Ah, I see what's going on. This is the problem:
https://github.com/gregnb/mui-datatables/blob/master/src/hooks/useColumnDrop.js#L9
The table calculates the offsetLeft of the table using the select cell. If it's not present, it uses an object with the offsetLeft set to zero. So tables without select cells that have an offset, will not have the right calculation in place.
I think I have this fixed:
https://codesandbox.io/s/muidatatables-custom-toolbar-thms7?file=/index.js
If you have a moment and can verify, it's in [email protected]:
npm install [email protected]
yup it works perfectly as expected now. thanks!
Fixed in 3.1.5