"sType": "numeric" --- not working

"sType": "numeric" --- not working

pwilsonpwilson Posts: 6Questions: 0Answers: 0
edited November 2011 in General
Hi All,

I have been working with dataTables for a week now. It seems like a good tool. I am having an issue with the stype sorting not working.

When I add "sType": "numeric" in the aoColumns def it stops sorting. Without the "sType": "numeric" it sorts the rows but not correctly for numeric.

Let me know if I am doing anything wrong.

Thanks
Phil


$(document).ready(function() {
var oTable = $("#projects_table").dataTable({
"oLanguage": {
"sSearch": "Search all columns:"
},
"sPaginationType": "full_numbers",
"bJQueryUI" : true,
"aaSorting": [[ 3, "desc" ]],
"aoColumns" : [
{"bSortable": true, "bSearchable": true, "bVisible": false, "sType": "numeric" },
{"bSortable": true, "bSearchable": true, "bVisible": false },
{"bSortable": true, "bSearchable": true, "bVisible": false },
{"bSortable": true, "bSearchable": true, "bVisible": false },
{"bSortable": true, "bSearchable": true, "bVisible": false },
{"bSortable": true, "bSearchable": true, "bVisible": false },
{"bSortable": true, "bSearchable": true, "bVisible": true }]
});

/* Activity */
oTable.fnSortListener( document.getElementById('sorter0'), 0 );

/* Date */
oTable.fnSortListener( document.getElementById('sorter1'), 1 );

/* Downloads */
oTable.fnSortListener( document.getElementById('sorter2'), 2 );

/* Followers */
oTable.fnSortListener( document.getElementById('sorter3'), 3 );

/* Owner Name */
oTable.fnSortListener( document.getElementById('sorter4'), 4 );

/* Project Name */
oTable.fnSortListener( document.getElementById('sorter5'), 5 );

/* Views */
oTable.fnSortListener( document.getElementById('sorter6'), 6 );
});



<%@include file="header.jsp"%>




















Activity
Creation Date
Downloads
Followers
Owner Name
Project Name
Views

Replies

  • pwilsonpwilson Posts: 6Questions: 0Answers: 0
    any feedback on this issue would be appreciated.

    Thanks
    Phil
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Numeric data will be automatically detected by DataTables since "numeric" is a built in sorting method. If it isn't being picked up as that, then its got non-numeric data somewhere in the column. This is confirmed by if you force it to numeric, then it stops working (sounds like a Javascript error - what does the Firebug/Inspector console say?).

    Allan
  • studio6000studio6000 Posts: 7Questions: 0Answers: 0
    i have the same exact issue as pwilson. I removed the only non-numeric character but it still does not sort. Please help.
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Please see: http://datatables.net/forums/discussion/9719/how-to-ask-for-help and post either a link to your test case with the issue or run the debugger over the table.

    Thanks,
    Allan
This discussion has been closed.