Custom Sorting
Custom Sorting
Hi,
I have a data table with a column which is combination of numeric & string. When it loads for the first time i get an error saying 'lenth is null or is not an object"
Here is the exact nature of my column......i have which holds . based on some condition i am either showing or stirng "insufficient number". when this table loads it fails on aoColumn. here is the code i am using:
[code]
tblKD = $("#tblKD").dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": true,
"bInfo": false,
"bAutoWidth": false,
"bJQueryUI": true,
"bSortClasses": false,
"asStripClasses": [],
"aoColumns": [
null,
null,
{ "sSortDataType": "dom-fav", "sType": "numeric" },
null,
null,
null,
{ "bSortable": false }
],
"aaSorting": []
});
$.fn.dataTableExt.afnSortData['dom-fav'] = function(oSettings, iColumn) {
var aData = [];
$('td:eq(' + iColumn + ') ul li.liFav', oSettings.oApi._fnGetTrNodes(oSettings)).each(function() {
aData.push(LPad($(this).attr('title').replace('%', ''), 2, '0'));
});
return aData;
}
[/code]
how can i handle this situation?
Thanks
Ash
I have a data table with a column which is combination of numeric & string. When it loads for the first time i get an error saying 'lenth is null or is not an object"
Here is the exact nature of my column......i have which holds . based on some condition i am either showing or stirng "insufficient number". when this table loads it fails on aoColumn. here is the code i am using:
[code]
tblKD = $("#tblKD").dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": true,
"bInfo": false,
"bAutoWidth": false,
"bJQueryUI": true,
"bSortClasses": false,
"asStripClasses": [],
"aoColumns": [
null,
null,
{ "sSortDataType": "dom-fav", "sType": "numeric" },
null,
null,
null,
{ "bSortable": false }
],
"aaSorting": []
});
$.fn.dataTableExt.afnSortData['dom-fav'] = function(oSettings, iColumn) {
var aData = [];
$('td:eq(' + iColumn + ') ul li.liFav', oSettings.oApi._fnGetTrNodes(oSettings)).each(function() {
aData.push(LPad($(this).attr('title').replace('%', ''), 2, '0'));
});
return aData;
}
[/code]
how can i handle this situation?
Thanks
Ash
This discussion has been closed.
Replies
Allan
it looks for a numeric value. If it finds a string instead of a number it fails. if i remove my string "insufficient responses" from this column & let it come out with valid interger numbers it works fine.
Allan