0
我正在建立一個移動房地產網站爲我妻子的業務使用Tablesorter按價格排序。它適用於6位數字(包括$ s和逗號),例如$ 600,000然而,當遇到7位數字時它失敗了,例如, $ 1,295,000。Tablesorter沒有排序百萬
在我
<script type="text/javascript" id="js">$(document).ready(function() {
$("table").tablesorter({
// sort on the second column, order asc
sortList: [[1,0]],
headers: {
1: { sorter: 'digit' } // column number, type
}
});
});
<table cellspacing="2" class="tablesorter { 0: { sorter: false}, 1: {sorter: true} }">
<thead>
<tr>
<th width="158" class="headerempty">Property</th>
<th width="130" class="{'sorter':'currency'}">Sort by Price</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><img src="../sales/29 Laurel Way/prepped_images/29lw-for_mobile.jpg" title="Tap for Details" alt="29 Laurel Way" width="150" height="100" border="0"></td>
<td class="{'sorter':'currency'}">$329,000</td>
</tr>
<tr class="odd">
<td><img src="../sales/Aetna Lane/al_for_Mobile.jpg" width="150" height="100"></td>
<td class="{'sorter':'currency'}">$175,000</td>
</tr>
<tr class="odd">
<td><img src="../sales/Atop Smith Hill/prepped/ash_mobile.jpg" width="150" height="100"></td>
<td class="{'sorter':'currency'}">$1,295,000</td>
</tr>
<tr class="odd">
<td><img src="../sales/Beech Hill/bh_mobile.jpg" width="150" height="100"></td>
<td class="{'sorter':'currency'}">$595,000</td>
</tr>
<tr class="odd">
<td class="{'sorter':'currency'}"><img src="../sales/Bluefield/b_mobile.jpg" width="150" height="100"></td>
<td>$299,000</td>
</tr>
</tbody>
</table>
想解決這個問題嗎?提前非常感謝,clpix
感謝您的回覆。然而,數百萬的價格仍然錯誤地排序。有什麼想法嗎? – clpix 2012-02-20 20:00:56
使用','而不是'。'。在數字分隔符。 [工作示例](http://paste.org.ru/?9ejmuw) – Jeka 2012-02-22 08:40:25
Jeka,感謝您的工作示例!解決了我的問題。我非常感激。最好的,clpix – clpix 2012-02-22 14:02:27