Hi,
Datatables is awesome!
I am facing an issue with reordering columns though. I wanted to predefine a column order for the table.
But only the table headers get reordered according to the indexes specified in "aiOrder".
I make an AJAX call which returns a csv file and use fnAddData to add the rows to the datatable.
I have placed the code for reordering the columns after the AJAX call and aoColumns:
Please help!
I cannot for the life of me figure out what's going wrong.
I am only able to move the columns around by dragging them.
Datatables is awesome!
I am facing an issue with reordering columns though. I wanted to predefine a column order for the table.
But only the table headers get reordered according to the indexes specified in "aiOrder".
I make an AJAX call which returns a csv file and use fnAddData to add the rows to the datatable.
I have placed the code for reordering the columns after the AJAX call and aoColumns:
$(document).ready(function(){ $.ajax({ type: "GET", url: "/abc", dataType: "text", success: function(data){ var records=$.csv.toArrays(data); for(i=1; i<records.length; i++){ $('#t-table').dataTable().fnAddData(records[i]); } } }); var oTable= $('#txnTable').dataTable( { "sDom": 'Rlfrtip', "bJQueryUI": true, "sPaginationType": "full_numbers", "aoColumnDefs": [ { "aTargets": [5], "bUseRendered": false, "fnRender": function(o){ return o.oSettings.fnFormatNumber(parseFloat(o.aData[o.iDataColumn])); } } ], "aoColumns": [ { "sTitle": "col1" }, { "sTitle": "col2" }, { "sTitle": "col3" }, { "sTitle": "col4" }, { "sTitle": "col5" }, { "sTitle": "col6", "sType": "numeric" }, ], "oColReorder": { "aiOrder": [0,1,2,6,5,4,3] } } );
Please help!
I cannot for the life of me figure out what's going wrong.
I am only able to move the columns around by dragging them.