2012-02-07 42 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