ColReorder not working right

ColReorder not working right

rvgrahamrvgraham Posts: 28Questions: 5Answers: 0

My table has a two row header (filtering inputs and selects in second row, 'bSortCellsTop' set to true). My app is a single page application, so whenever the data requested changes the grid must be re-populated using 'bDestroy' true.

I have a global constant 'colReorder', which is assigned each time the grid is re-populated with:
colReorder = new $.fn.dataTable.ColReorder(table);

When I re-fill the table, I get the current, altered order with a call: var colOrder = colReorder.fnOrder(), before the table is destroyed and re-filled.

After the table is re-filled, if it's not the initial fill, I call colReorder.fnOrder(colOrder).

'colOrder' is absolutely correct, I've checked it many times. Now if I move col[2] to pos[4], and then reload the grid with different data (same schema of course) colOrder is 0, 1, 3, 4, 2, 5, 6, 7... exactly as it ought to be.

Now the problem, the columns, their data and their widths are exactly correct and following the order 0, 1, 3, 4, 2, 5, 6, 7..., but the th elements in the thead are in the wrong order in a way that is totally perplexing. colheader[2] is at pos[3] instead of 4, and colheader[3] is at pos[4], where colheader[2] ought to be. And colheader[3] wasn't supposed to be affected in any way!

A column on the "far" side of the moved column has leapfrogged over to the other side of the moved column.

I am really clueless about publishing a test case but maybe someone else has seen and solved this issue?

Thx, Bob Graham

This discussion has been closed.