jeffreydwalter / ColReorderWithResize

Column reordering and resizing plug-in for DataTables
http://www.datatables.net/
MIT License
42 stars 51 forks source link

Resize works only with ordering:true #4

Closed shashank1010 closed 6 years ago

shashank1010 commented 6 years ago

Unable to resize the columns unless I keep ordering option to be true. I do not wish to give sorting abilities to the user using the datatables because I manage that from the server. I have reviewed the issue, will try to document it.

In DataTables 1.10.2 https://github.com/DataTables/DataTables/blob/master/media/js/jquery.dataTables.js#L1783 _fnCompatMap( init, 'ordering', 'bSort' ); sets bsort option to be false when i set the ordering option as false.

This results in the column[n].bsortable option to be false as per https://github.com/DataTables/DataTables/blob/master/media/js/jquery.dataTables.js#L2083

With the column[n].bsortable option set to false the plugin cannot set {'cursor': 'col-resize'} on the column, thus disabling the drag and resize functionality of the columns. https://github.com/jeffreydwalter/ColReorderWithResize/blob/master/ColReorderWithResize.js#L960

Possible fix: checking if (!aoColumns[i].bSortable === false || that.s.dt.oFeatures.bSort === false) on https://github.com/jeffreydwalter/ColReorderWithResize/blob/master/ColReorderWithResize.js#L960 Apologies for the long read.

jeffreydwalter commented 6 years ago

Thanks for the detailed write up and the PR.