oColReorder aiOrder & aaSorting problem
oColReorder aiOrder & aaSorting problem
Hello, I'm new to web design, so I can't figure out what problem happened or conflicted. Please don't blame...
If anyone can, please help me out.
I wrote the script script below, using the "aiOrder" of "oColReorder", and also "aaSorting": [[3,'asc']],
The output for the result affect on my first table as I expected,
It did auto-sort the "original column 3" , and did re-ordered to the 2nd place of the column
but on the second table,
the "original column 3" is re-ordered to the 2nd place as expected, but the aaSorting function had the effect on the "re-ordered column 3", which was the original column 1.
I tried "aaSortingFixed" as well, but the result is the same.
The tables might look like this:
[code]
Table1
0Alpha 3Delta(Sorted) 2Gamma 1Beta 4Epsilon 5Zeta(hided)
Table2
0Alpha 3Delta 2Gamma 1Beta(Sorted) 4Epsilon 5Zeta(hided)
[/code]
The original script inside the html:
[code]
$(function() {
var opt={
"sDom": 'R<"H"lfr>t<"F"ip>',
"aaSorting": [[3,'asc']],
"oColReorder": {
"aiOrder": [ 0, 3, 2, 1, 4, 5 ]
},
"bPaginate": false,
"bJQueryUI":true,
"aoColumnDefs": [ { "bSearchable": false, aTargets: [0,4,5] },
{"bVisible": false, "aTargets": [5] },
{"bSortable": false, "aTargets": [0,4,5] },],
};
var oTable1=$("#example1").dataTable(opt);
oTable1.$('tr').click(function() {
var row=oTable1.fnGetData(this);
window.open(row[5]);
});
var oTable2=$("#example2").dataTable(opt);
oTable2.$('tr').click(function() {
var row=oTable2.fnGetData(this);
window.open(row[5]);
});
});
[/code]
The 2 tables with id="example1" and "example2" not important to list out.
Also if anyone can help on making the code below shorter or write in a better way.
[code]
var oTable1=$("#example1").dataTable(opt);
oTable1.$('tr').click(function() {
var row=oTable1.fnGetData(this);
window.open(row[5]);
});
var oTable2=$("#example2").dataTable(opt);
oTable2.$('tr').click(function() {
var row=oTable2.fnGetData(this);
window.open(row[5]);
});
[/code]
Still learning how to write properly...
Thank you.
If anyone can, please help me out.
I wrote the script script below, using the "aiOrder" of "oColReorder", and also "aaSorting": [[3,'asc']],
The output for the result affect on my first table as I expected,
It did auto-sort the "original column 3" , and did re-ordered to the 2nd place of the column
but on the second table,
the "original column 3" is re-ordered to the 2nd place as expected, but the aaSorting function had the effect on the "re-ordered column 3", which was the original column 1.
I tried "aaSortingFixed" as well, but the result is the same.
The tables might look like this:
[code]
Table1
0Alpha 3Delta(Sorted) 2Gamma 1Beta 4Epsilon 5Zeta(hided)
Table2
0Alpha 3Delta 2Gamma 1Beta(Sorted) 4Epsilon 5Zeta(hided)
[/code]
The original script inside the html:
[code]
$(function() {
var opt={
"sDom": 'R<"H"lfr>t<"F"ip>',
"aaSorting": [[3,'asc']],
"oColReorder": {
"aiOrder": [ 0, 3, 2, 1, 4, 5 ]
},
"bPaginate": false,
"bJQueryUI":true,
"aoColumnDefs": [ { "bSearchable": false, aTargets: [0,4,5] },
{"bVisible": false, "aTargets": [5] },
{"bSortable": false, "aTargets": [0,4,5] },],
};
var oTable1=$("#example1").dataTable(opt);
oTable1.$('tr').click(function() {
var row=oTable1.fnGetData(this);
window.open(row[5]);
});
var oTable2=$("#example2").dataTable(opt);
oTable2.$('tr').click(function() {
var row=oTable2.fnGetData(this);
window.open(row[5]);
});
});
[/code]
The 2 tables with id="example1" and "example2" not important to list out.
Also if anyone can help on making the code below shorter or write in a better way.
[code]
var oTable1=$("#example1").dataTable(opt);
oTable1.$('tr').click(function() {
var row=oTable1.fnGetData(this);
window.open(row[5]);
});
var oTable2=$("#example2").dataTable(opt);
oTable2.$('tr').click(function() {
var row=oTable2.fnGetData(this);
window.open(row[5]);
});
[/code]
Still learning how to write properly...
Thank you.
This discussion has been closed.