ColReorderWithResize.js and fnReset issue

ColReorderWithResize.js and fnReset issue

camster444camster444 Posts: 1Questions: 0Answers: 0
edited May 2013 in Bug reports
Not sure if this is the right place, but this is my first post. Or even if this issue has been raised before.

I'm having lots of fun with this plugin (really!) but I noticed an issue with Christophe Battarel/Martin Marchetta's modifications to the ColReorder plugin. The column indexes get reset when the columns are moved, so an fnReset() has no effect.

So the user experience on an fnReset() is "no change". fnReset() works fine on the original ColReorder.js so the problem is the extra modifications.

So the basic changes are:

/* Sort listener */
for (i = 0, iLen = iCols; i < iLen; i++) {
// Comment out the below:
// //Martin Marchetta:
// //Update this field which is the one used by DataTables for getting the column's data for sorting.
// oSettings.aoColumns[i].aDataSort = [i];
// //Update the internal column index, since columns are actually being re-ordered in the internal structure
// oSettings.aoColumns[i]._ColReorder_iOrigCol = i;
// ///////////////////////////////////
this.oApi._fnSortAttachListener(oSettings, oSettings.aoColumns[i].nTh, i);

And this:

// Comment out the below
//Martin Marchetta: Re-initialize so as to register the new column order
//(otherwise the events remain bound to the original column indices)

I also had issues with the data columns not moving when the header column was moved while using a Y-axis scrollbar so I made the following modification in _fnMouseUp():

if (!scrollXEnabled) {
if (this.s.dt.oScroll.sX !== "" || this.s.dt.oScroll.sY !== "") {

I hope this helps somebody, because it took me a bit of time to figure all this out. Anyway the above is working for what I'm doing - it probably breaks something else, but someone more knowledgeable than me can hopefully fix it.
This discussion has been closed.