2012-02-07 37 views
2

使用jQuery 1.9.0 datablesDatables数字排序问题

$('#list').dataTable({  
    "bJQueryUI": true, 
    "iDisplayLength": 25, 
    "aaSorting": [[ 0, "desc" ]]  
}) 

得到这个画面时,我尝试通过排序ID的

enter image description here

我怎样才能解决这个问题?

回答

2

尝试将data type of particular column

$(document).ready(function() { 
    $('#example').dataTable({ 
     "aoColumns": [ 
      { "sType": "numeric-comma" }, 
      null, 
      null, 
      null, 
      null 
     ] 
    }); 
}); 
+0

让我在正确的轨道上,但找到背后的代码奇怪。为什么它会用逗号替换逗号? – ficuscr 2015-06-16 21:06:35

0

尝试natural-desc

$('#list').dataTable({  
    "bJQueryUI": true, 
    "iDisplayLength": 25, 
    "aaSorting": [[ 0, "natural-desc" ]], 
    "aoColumns": [ 
     { "sType": "natural-desc" }, 
     .... 
    ] 
}) 

请参见:Natural sortingPlugin List

+0

是的,但是当我点击ID列,它重新排序整列,并得到相同的结果 – heron 2012-02-07 08:39:30