Problems using ColReorder and aiOrder
Problems using ColReorder and aiOrder
Hi,
On our site we've got a table that's being filled in dynamically, as is the aiOrder for oColReorder so that the columns order the way the user has chose. We have 2 very similar pages that load slightly different content, on one of them aiOrder works fine, on the other we get the error "ColReorder - array reorder does not match known number of columns. Skipping.", even though it's working in the same way on both.
Also on both pages we get a lot of "ColReorder 'from' index is out of bounds: -1 ", though this doesn't seem to stop any functionality working but would be good to get rid of it.
Here is the table declaration for the one that works fine:
[code]
var oTable = $('#schedule-table').dataTable({
"aaSorting": [[ 0, "asc" ]],
"sPaginationType": "full_numbers",
"sDom": 'Rlfrtip',
"oColReorder": {
"aiOrder": [<#ColumnOrder>]
},
"iDisplayLength": 50,
"aoColumnDefs": [
{"bSortable": true, aTargets: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,15]},
{"bSortable": false, aTargets: [14]},
{"sType": "date-dd-mmm-yyyy", aTargets: []},
{"sType": "percent-period", aTargets: [7,8,9]},
{"sType": "num-html", aTargets: [5]},
{"sType": "numeric-comma", aTargets: [4,6,10,11,12,13]},
{"bVisible": false, aTargets: [<#HiddenColumns>]}
],
[/code]
And here is the one that gets the first error above:
[code]
var oTable = $('#schedule-table').dataTable({
"aaSorting": [[ 0, "asc" ]],
"sPaginationType": "full_numbers",
"sDom": 'Rlfrtip',
"oColReorder": {
"aiOrder": [<#ColumnOrder>]
},
"iDisplayLength": 50,
"aoColumnDefs": [
{"bSortable": true, aTargets: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]},
{"bSortable": false, aTargets: []},
{"sType": "date-dd-mmm-yyyy", aTargets: [4,5,6]},
{"sType": "numeric-comma", aTargets: [7,9,10]},
{"bVisible": false, aTargets: [<#HiddenColumns>]}
],
[/code]
This is the first page with the tags filled in:
[code]
var oTable = $('#schedule-table').dataTable({
"aaSorting": [[ 0, "asc" ]],
"sPaginationType": "full_numbers",
"sDom": 'Rlfrtip',
"oColReorder": {
"aiOrder": [0,15,1,2]
},
"iDisplayLength": 50,
"aoColumnDefs": [
{"bSortable": true, aTargets: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,15]},
{"bSortable": false, aTargets: [14]},
{"sType": "date-dd-mmm-yyyy", aTargets: []},
{"sType": "percent-period", aTargets: [7,8,9]},
{"sType": "num-html", aTargets: [5]},
{"sType": "numeric-comma", aTargets: [4,6,10,11,12,13]},
{"bVisible": false, aTargets: [3,4,5,6,7,8,9,10,11,12,13,14,13]}
],
[/code]
As you can see, only 4 columns are being specified in aiOrder, but it still works correctly. On the other table however it doesn't, and we have no idea why.
What's going on?
On our site we've got a table that's being filled in dynamically, as is the aiOrder for oColReorder so that the columns order the way the user has chose. We have 2 very similar pages that load slightly different content, on one of them aiOrder works fine, on the other we get the error "ColReorder - array reorder does not match known number of columns. Skipping.", even though it's working in the same way on both.
Also on both pages we get a lot of "ColReorder 'from' index is out of bounds: -1 ", though this doesn't seem to stop any functionality working but would be good to get rid of it.
Here is the table declaration for the one that works fine:
[code]
var oTable = $('#schedule-table').dataTable({
"aaSorting": [[ 0, "asc" ]],
"sPaginationType": "full_numbers",
"sDom": 'Rlfrtip',
"oColReorder": {
"aiOrder": [<#ColumnOrder>]
},
"iDisplayLength": 50,
"aoColumnDefs": [
{"bSortable": true, aTargets: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,15]},
{"bSortable": false, aTargets: [14]},
{"sType": "date-dd-mmm-yyyy", aTargets: []},
{"sType": "percent-period", aTargets: [7,8,9]},
{"sType": "num-html", aTargets: [5]},
{"sType": "numeric-comma", aTargets: [4,6,10,11,12,13]},
{"bVisible": false, aTargets: [<#HiddenColumns>]}
],
[/code]
And here is the one that gets the first error above:
[code]
var oTable = $('#schedule-table').dataTable({
"aaSorting": [[ 0, "asc" ]],
"sPaginationType": "full_numbers",
"sDom": 'Rlfrtip',
"oColReorder": {
"aiOrder": [<#ColumnOrder>]
},
"iDisplayLength": 50,
"aoColumnDefs": [
{"bSortable": true, aTargets: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]},
{"bSortable": false, aTargets: []},
{"sType": "date-dd-mmm-yyyy", aTargets: [4,5,6]},
{"sType": "numeric-comma", aTargets: [7,9,10]},
{"bVisible": false, aTargets: [<#HiddenColumns>]}
],
[/code]
This is the first page with the tags filled in:
[code]
var oTable = $('#schedule-table').dataTable({
"aaSorting": [[ 0, "asc" ]],
"sPaginationType": "full_numbers",
"sDom": 'Rlfrtip',
"oColReorder": {
"aiOrder": [0,15,1,2]
},
"iDisplayLength": 50,
"aoColumnDefs": [
{"bSortable": true, aTargets: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,15]},
{"bSortable": false, aTargets: [14]},
{"sType": "date-dd-mmm-yyyy", aTargets: []},
{"sType": "percent-period", aTargets: [7,8,9]},
{"sType": "num-html", aTargets: [5]},
{"sType": "numeric-comma", aTargets: [4,6,10,11,12,13]},
{"bVisible": false, aTargets: [3,4,5,6,7,8,9,10,11,12,13,14,13]}
],
[/code]
As you can see, only 4 columns are being specified in aiOrder, but it still works correctly. On the other table however it doesn't, and we have no idea why.
What's going on?
This discussion has been closed.