Custom Sort and bVisibile
Custom Sort and bVisibile
I'm having a small problem with bVisible and a custom sort function. It seems that iColumn is sending the old column count from before the bVisible column was hidden. I've just hard coded the new column number into the sorting function as a temporary fix.
I'm not sure if this is a bug or if I'm doing something wrong.
Here is my code:
[code]/* Custom image sort by rel */
$.fn.dataTableExt.afnSortData['dom-img'] = function ( oSettings, iColumn ) {
var aData = [];
$( 'td:eq('+iColumn+') img', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
aData.push( $(this).attr('rel') );
} );
return aData;
}[/code]
[code]var oTable = $("#profile1").dataTable({
"aaSorting": [[ 2, "asc" ], [1, "asc"]],
"iDisplayLength": 25,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "bVisible":false },
{ "sWidth": "16px", "sSortDataType": "dom-img" },
{ "sWidth": "125px" },
{ "sWidth": "198px" }
],
"bAutoWidth": false
});[/code]
I'm not sure if this is a bug or if I'm doing something wrong.
Here is my code:
[code]/* Custom image sort by rel */
$.fn.dataTableExt.afnSortData['dom-img'] = function ( oSettings, iColumn ) {
var aData = [];
$( 'td:eq('+iColumn+') img', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
aData.push( $(this).attr('rel') );
} );
return aData;
}[/code]
[code]var oTable = $("#profile1").dataTable({
"aaSorting": [[ 2, "asc" ], [1, "asc"]],
"iDisplayLength": 25,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "bVisible":false },
{ "sWidth": "16px", "sSortDataType": "dom-img" },
{ "sWidth": "125px" },
{ "sWidth": "198px" }
],
"bAutoWidth": false
});[/code]
This discussion has been closed.
Replies
Allan
Gath