2011-09-03 49 views

回答

1

這很奇怪......但是,我發現如果將分揀機設置爲「文本」,它會修復此問題。

$('table').tablesorter({ 
    headers : { 
     0: { sorter: "text" } 
    } 
}); 

這裏是a demo。在數字列中,「?」被視爲零。

+0

謝謝!現在,如果我可以更多地利用你的知識:我怎樣才能讓問號總是以排序順序排在最後,而不是在「a」之前排序呢? – Dabblernl

+0

嗯,問號的ascii值小於字母表的ascii值,所以我可以嘗試將'?'改成'〜'(代字號)([demo](http://jsfiddle.net/) Mottie/rbrjJ/2 /)),因爲它的值在([ref](http://ascii-table.com/))之後。如果您有興趣,我的github上有一個[fork](http://mottie.github.com/tablesorter/)插件,可以讓您[在數字列中排序文本](http: //mottie.github.com/tablesorter/docs/example-options-headers-digits-strings.html)如何你想要的。 – Mottie