ColReorder + FixedColumns plugin
ColReorder + FixedColumns plugin
Hi,
I just started using Datatables.js. I have a requirement to be able to use ColReorder + FixedColumns plugins on the same table. The bug I think I've found:
- Create a datatable, my datatable has 8 columns but column count doesn't mather
- use ColumnsPlugin plugin, set the first two columns to fixed
...
"oColReorder": {
"iFixedColumns": 2
}
...
- use FixedColumns plugin, set iLeftColumns to 2
....
new FixedColumns(oTable, {
"iLeftColumns": 2,
"iLeftWidth": 264
})
....
Now if you start dragging column header:
- you cannot drag the first two columns that are fixed by the FixedColumns plugin - ok
- you cannot drag elements before/between the first two columns that are fixed by the FixedColumn plugin - ok
- you can drag the first two columns that are NOT fixed by the FixedColumns plugin - ok
Issue: you cannot drag elements to before/between the first two columns NOT fixed by the FixedColumns plugin. For example, if you would like to move the third column NOT fixed by the FixedColumns plugin to between the first and second column, you can't.
You can reproduce this bug on the demo site too:
http://datatables.net/release-datatables/extras/ColReorder/fixedcolumns.html
You cannot move the Browser column to between the index column and the Rendering engine column.
I think the problem is, that there should be to numbers: iFixedColumns: how many columns cannot be moved counted from the left.
iFixedByFixedColumnsPlugin.
...
"oColReorder": {
"iFixedColumns": 2
"iFixedByTheFixedColumnsPlugin": 2
}
...
ColReorder _fnMouseDown:
aoTargets array does not contain the columns that are fixed by the FixedColumns plugin, so those columns shouldn't be spliced.
/* Disallow columns for being reordered by drag and drop, counting left to right */
if (this.s.fixed !== 0)
{
this.s.aoTargets.splice( 0, this.s.fixed - this.s.fixedByFixedColumnsPlugin );
}
ColReorder _fnMouseMove:
when calculating this.s.mouse.toIndex is calculated based on the non fixed table indexes, to make the fnArraySwitch function work properly with, the toIndex should be added up by the this.s.fixedByFixedColumnsPlugin number:
"_fnMouseMove": function ( e )
{
.....
/* Based on the current mouse position, calculate where the insert should go */
var bSet = false;
for ( var i=1, iLen=this.s.aoTargets.length ; i
I just started using Datatables.js. I have a requirement to be able to use ColReorder + FixedColumns plugins on the same table. The bug I think I've found:
- Create a datatable, my datatable has 8 columns but column count doesn't mather
- use ColumnsPlugin plugin, set the first two columns to fixed
...
"oColReorder": {
"iFixedColumns": 2
}
...
- use FixedColumns plugin, set iLeftColumns to 2
....
new FixedColumns(oTable, {
"iLeftColumns": 2,
"iLeftWidth": 264
})
....
Now if you start dragging column header:
- you cannot drag the first two columns that are fixed by the FixedColumns plugin - ok
- you cannot drag elements before/between the first two columns that are fixed by the FixedColumn plugin - ok
- you can drag the first two columns that are NOT fixed by the FixedColumns plugin - ok
Issue: you cannot drag elements to before/between the first two columns NOT fixed by the FixedColumns plugin. For example, if you would like to move the third column NOT fixed by the FixedColumns plugin to between the first and second column, you can't.
You can reproduce this bug on the demo site too:
http://datatables.net/release-datatables/extras/ColReorder/fixedcolumns.html
You cannot move the Browser column to between the index column and the Rendering engine column.
I think the problem is, that there should be to numbers: iFixedColumns: how many columns cannot be moved counted from the left.
iFixedByFixedColumnsPlugin.
...
"oColReorder": {
"iFixedColumns": 2
"iFixedByTheFixedColumnsPlugin": 2
}
...
ColReorder _fnMouseDown:
aoTargets array does not contain the columns that are fixed by the FixedColumns plugin, so those columns shouldn't be spliced.
/* Disallow columns for being reordered by drag and drop, counting left to right */
if (this.s.fixed !== 0)
{
this.s.aoTargets.splice( 0, this.s.fixed - this.s.fixedByFixedColumnsPlugin );
}
ColReorder _fnMouseMove:
when calculating this.s.mouse.toIndex is calculated based on the non fixed table indexes, to make the fnArraySwitch function work properly with, the toIndex should be added up by the this.s.fixedByFixedColumnsPlugin number:
"_fnMouseMove": function ( e )
{
.....
/* Based on the current mouse position, calculate where the insert should go */
var bSet = false;
for ( var i=1, iLen=this.s.aoTargets.length ; i
This discussion has been closed.
Replies
Allan
this.s.mouse.toIndex = this.s.aoTargets[this.s.aoTargets.length-1].to + this.s.fixedBFixedColumnsPlugin;
This is the right one:
if (this.s.mouse.toIndex < this.s.fixedByFixedColumnsPlugin) {
this.s.mouse.toIndex += this.s.fixedByFixedColumnsPlugin;
}
did you ever come back to this issue?
Alex
I just downloaded version 1.0.8 and the bug is still present. Is there any fix to it available in a newer version?
-Jon
Allan
I am looking for a Table widget that can do the fixed column, column reordering, right scroll and also automatically pagination when you scroll down.
Thank you
Shashi