tablesorter无法对类似的列进行排序

时间:2016-02-13 13:04:15

标签: jquery sorting tablesorter

我有多个具有相同数据类型的列,当我尝试对它们进行排序时,有些列会被排序,而其他一些列只会恢复为默认的sortlist选项。

HTML:

<table id="WatchListDataTable_21631" class="tablesorter ui-scrollview-view tablesorter-default hasResizable hasStickyHeaders" role="grid" style="overflow: hidden; position: relative; left: 0px; top: 0px;">
<thead>
    <tr role="row" class="tablesorter-headerRow">
        <th data-sel="Close" data-column="0" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="الاغلاق: No sort applied, activate to apply an ascending sort" style="width: 68px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>الاغلاق</span>      </div>
        </th>
        <th data-sel="Open" data-column="1" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="افتتاح: No sort applied, activate to apply an ascending sort" style="width: 56px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>افتتاح</span>      </div>
        </th>
        <th data-sel="Low" data-column="2" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="ادنى: No sort applied, activate to apply an ascending sort" style="width: 46px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>ادنى</span>      </div>
        </th>
        <th data-sel="High" data-column="3" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="اعلى: No sort applied, activate to apply an ascending sort" style="width: 47px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>اعلى</span>      </div>
        </th>
        <th data-sel="Offer" data-column="4" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="العرض: No sort applied, activate to apply an ascending sort" style="width: 48px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>العرض</span>      </div>
        </th>
        <th data-sel="OfrQty" data-column="5" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="ك العرض: No sort applied, activate to apply an ascending sort" style="width: 69px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span> ك العرض</span>      </div>
        </th>
        <th data-sel="BidPrice" data-column="6" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="الطلب: No sort applied, activate to apply an ascending sort" style="width: 54px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>الطلب</span>      </div>
        </th>
        <th data-sel="BidQty" data-column="7" class="tablesorter-header tablesorter-headerDesc primary" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="descending" aria-label="ك الطلب: Descending sort applied, activate to apply an ascending sort" style="width: 88px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>ك الطلب</span>      </div>
        </th>
        <th data-sel="TradedVol" data-column="8" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="حجم الصفقات: No sort applied, activate to apply an ascending sort" style="width: 72px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>حجم الصفقات</span>      </div>
        </th>
        <th data-sel="Traded" data-column="9" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="الصفقات: No sort applied, activate to apply an ascending sort" style="width: 69px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>الصفقات</span>      </div>
        </th>
        <th data-sel="Time" data-column="10" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="الوقت: No sort applied, activate to apply an ascending sort" style="width: 48px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>الوقت</span>      </div>
        </th>
        <th data-sel="Prcnt" data-column="11" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="%نسبة: No sort applied, activate to apply an ascending sort" style="width: 49px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span> %نسبة</span>      </div>
        </th>
        <th data-sel="Change" data-column="12" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="التغيير: No sort applied, activate to apply an ascending sort" style="width: 58px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>التغيير</span>      </div>
        </th>
        <th data-sel="LastQty" data-column="13" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="اخر كميه: No sort applied, activate to apply an ascending sort" style="width: 58px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>اخر كميه</span>      </div>
        </th>
        <th data-sel="LastPrice" data-column="14" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="اخر سعر: No sort applied, activate to apply an ascending sort" style="width: 82px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>اخر سعر</span>      </div>
        </th>
        <th data-sel="Company" data-column="15" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="الاسم: No sort applied, activate to apply an ascending sort" style="width: 125px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>الاسم</span>      </div>
        </th>
        <th data-sel="Symbol" data-column="16" class="tablesorter-header tablesorter-headerUnSorted" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="WatchListDataTable_21631" unselectable="on" aria-sort="none" aria-label="السهم: No sort applied, activate to apply an ascending sort" style="width: 58px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>السهم</span> <span class="SymbolStatusIcon"></span>      </div>
        </th>
        <th data-sel="#" class="resizable-false columnSelector-disable sorter-false cancel-drag dragtable-drag-boundary tablesorter-header tablesorter-headerUnSorted" data-column="17" scope="col" role="columnheader" aria-disabled="true" unselectable="on" aria-sort="none" aria-label="#: No sort applied, sorting is disabled" style="width: 30px;">
            <div class="tablesorter-header-inner"><i class="tablesorter-icon"></i>        <span>#</span>      </div>
        </th>
    </tr>
</thead>
<tbody id="TableRowsTemplate" aria-live="polite" aria-relevant="all">
    <tr id="DivID_21631_2350_Row" role="row">
        <td data-sel="Close" class="">       <span id="DivID_21631_2350_Close" class="cell-data">4.59</span>      </td>
        <td data-sel="Open" class="">       <span id="DivID_21631_2350_Open" class="cell-data">4.90</span>      </td>
        <td data-sel="Low" class="">       <span id="DivID_21631_2350_Low" class="cell-data">4.55</span>      </td>
        <td data-sel="High" class="">       <span id="DivID_21631_2350_High" class="cell-data">4.90</span>      </td>
        <td data-sel="Offer" class="">       <span id="DivID_21631_2350_Offer" class="cell-data">4.60</span>      </td>
        <td data-sel="OfrQty" class="">       <span id="DivID_21631_2350_OfrQty" class="cell-data">91,519</span>      </td>
        <td data-sel="BidPrice">       <span id="DivID_21631_2350_BidPrice" class="cell-data">4.55</span>      </td>
        <td data-sel="BidQty" class="primary">       <span id="DivID_21631_2350_BidQty" class="cell-data">853,284</span>      </td>
        <td data-sel="TradedVol" class="">       <span id="DivID_21631_2350_TradedVol" class="cell-data">18,356,347</span>      </td>
        <td data-sel="Traded" class="">       <span id="DivID_21631_2350_Traded" class="cell-data">1,885</span>      </td>
        <td data-sel="Time" class="">       <span id="DivID_21631_2350_Time" class="cell-data">15:29:49</span>      </td>
        <td data-sel="Prcnt" class="changedowntdcssclass">       <span id="DivID_21631_2350_Prcnt" class="cell-data">-6.14%</span>      </td>
        <td data-sel="Change" class="changedowntdcssclass">       <span id="DivID_21631_2350_Change" class="cell-data">-0.30</span>      </td>
        <td data-sel="LastQty" class="">       <span id="DivID_21631_2350_LastQty" class="cell-data">18,964</span>      </td>
        <td data-sel="Company">       <span id="DivID_21631_2350_Company" class="cell-data">كيان</span>      </td>
        <td data-sel="Symbol">       <span id="DivID_21631_2350_Symbol" class="cell-data">2350</span>             </td>
    </tr>
    <tr id="DivID_21631_4300_Row" role="row">
        <td data-sel="Close" class="">       <span id="DivID_21631_4300_Close" class="cell-data">4.55</span>      </td>
        <td data-sel="Open" class="">       <span id="DivID_21631_4300_Open" class="cell-data">4.85</span>      </td>
        <td data-sel="Low" class="">       <span id="DivID_21631_4300_Low" class="cell-data">4.55</span>      </td>
        <td data-sel="High" class="">       <span id="DivID_21631_4300_High" class="cell-data">4.90</span>      </td>
        <td data-sel="Offer" class="">       <span id="DivID_21631_4300_Offer" class="cell-data">4.60</span>      </td>
        <td data-sel="OfrQty" class="">       <span id="DivID_21631_4300_OfrQty" class="cell-data">1,034,124</span>      </td>
        <td data-sel="BidPrice">       <span id="DivID_21631_4300_BidPrice" class="cell-data">4.55</span>      </td>
        <td data-sel="BidQty" class="primary">       <span id="DivID_21631_4300_BidQty" class="cell-data">823,252</span>      </td>
        <td data-sel="TradedVol" class="">       <span id="DivID_21631_4300_TradedVol" class="cell-data">35,065,138</span>      </td>
        <td data-sel="Traded" class="">       <span id="DivID_21631_4300_Traded" class="cell-data">3,385</span>      </td>
        <td data-sel="Time" class="">       <span id="DivID_21631_4300_Time" class="cell-data">15:29:54</span>      </td>
        <td data-sel="Prcnt" class="changedowntdcssclass">       <span id="DivID_21631_4300_Prcnt" class="cell-data">-6.95%</span>      </td>
        <td data-sel="Change" class="changedowntdcssclass">       <span id="DivID_21631_4300_Change" class="cell-data">-0.34</span>      </td>
        <td data-sel="LastQty" class="">       <span id="DivID_21631_4300_LastQty" class="cell-data">60,000</span>      </td>
        <td data-sel="Company">       <span id="DivID_21631_4300_Company" class="cell-data">دار الأركان</span>      </td>
        <td data-sel="Symbol">       <span id="DivID_21631_4300_Symbol" class="cell-data">4300</span>             </td>
    </tr>
    <tr id="DivID_21631_7040_Row" role="row">
        <td data-sel="Close" class="">       <span id="DivID_21631_7040_Close" class="cell-data">3.90</span>      </td>
        <td data-sel="Open" class="">       <span id="DivID_21631_7040_Open" class="cell-data">4.15</span>      </td>
        <td data-sel="Low" class="">       <span id="DivID_21631_7040_Low" class="cell-data">3.90</span>      </td>
        <td data-sel="High" class="">       <span id="DivID_21631_7040_High" class="cell-data">4.25</span>      </td>
        <td data-sel="Offer" class="">       <span id="DivID_21631_7040_Offer" class="cell-data">3.95</span>      </td>
        <td data-sel="OfrQty" class="">       <span id="DivID_21631_7040_OfrQty" class="cell-data">148,715</span>      </td>
        <td data-sel="BidPrice">       <span id="DivID_21631_7040_BidPrice" class="cell-data">3.90</span>      </td>
        <td data-sel="BidQty" class="primary">       <span id="DivID_21631_7040_BidQty" class="cell-data">363,928</span>      </td>
        <td data-sel="TradedVol" class="">       <span id="DivID_21631_7040_TradedVol" class="cell-data">6,269,310</span>      </td>
        <td data-sel="Traded" class="">       <span id="DivID_21631_7040_Traded" class="cell-data">1,037</span>      </td>
        <td data-sel="Time" class="">       <span id="DivID_21631_7040_Time" class="cell-data">15:29:47</span>      </td>
        <td data-sel="Prcnt" class="changedowntdcssclass">       <span id="DivID_21631_7040_Prcnt" class="cell-data">-5.80%</span>      </td>
        <td data-sel="Change" class="changedowntdcssclass">       <span id="DivID_21631_7040_Change" class="cell-data">-0.24</span>      </td>
        <td data-sel="LastQty" class="">       <span id="DivID_21631_7040_LastQty" class="cell-data">20,216</span>      </td>
        <td data-sel="Company">       <span id="DivID_21631_7040_Company" class="cell-data">عذيب للاتصالات</span>      </td>
        <td data-sel="Symbol">       <span id="DivID_21631_7040_Symbol" class="cell-data">7040</span>               <span id="DivID_21631_7040_SymbolColor" class="SymbolStatus" style="background: Yellow;"></span>             </td>
    </tr>
    <tr id="DivID_21631_9400_Row" role="row">
        <td data-sel="Close" class="">       <span id="DivID_21631_9400_Close" class="cell-data">21.30</span>      </td>
        <td data-sel="Open" class="">       <span id="DivID_21631_9400_Open" class="cell-data">21.10</span>      </td>
        <td data-sel="Low" class="">       <span id="DivID_21631_9400_Low" class="cell-data">21.10</span>      </td>
        <td data-sel="High" class="">       <span id="DivID_21631_9400_High" class="cell-data">21.30</span>      </td>
        <td data-sel="Offer" class="">       <span id="DivID_21631_9400_Offer" class="cell-data">21.20</span>      </td>
        <td data-sel="OfrQty" class="">       <span id="DivID_21631_9400_OfrQty" class="cell-data">150,281</span>      </td>
        <td data-sel="BidPrice">       <span id="DivID_21631_9400_BidPrice" class="cell-data">21.00</span>      </td>
        <td data-sel="BidQty" class="primary">       <span id="DivID_21631_9400_BidQty" class="cell-data">149,881</span>      </td>
        <td data-sel="TradedVol" class="">       <span id="DivID_21631_9400_TradedVol" class="cell-data">239,838</span>      </td>
        <td data-sel="Traded" class="">       <span id="DivID_21631_9400_Traded" class="cell-data">7</span>      </td>
        <td data-sel="Time" class="">       <span id="DivID_21631_9400_Time" class="cell-data">14:51:10</span>      </td>
        <td data-sel="Prcnt" class="changedowntdcssclass">       <span id="DivID_21631_9400_Prcnt" class="cell-data">-2.29%</span>      </td>
        <td data-sel="Change" class="changedowntdcssclass">       <span id="DivID_21631_9400_Change" class="cell-data">-0.50</span>      </td>
        <td data-sel="LastQty" class="">       <span id="DivID_21631_9400_LastQty" class="cell-data">41,123</span>      </td>
        <td data-sel="Company">       <span id="DivID_21631_9400_Company" class="cell-data">فالكم 30</span>      </td>
        <td data-sel="Symbol">       <span id="DivID_21631_9400_Symbol" class="cell-data">9400</span>             </td>
    </tr>
    <tr id="DivID_21631_4140_Row" role="row">
        <td data-sel="Close" class="">       <span id="DivID_21631_4140_Close" class="cell-data">36.08</span>      </td>
        <td data-sel="Open" class="">       <span id="DivID_21631_4140_Open" class="cell-data">38.10</span>      </td>
        <td data-sel="Low" class="">       <span id="DivID_21631_4140_Low" class="cell-data">35.10</span>      </td>
        <td data-sel="High" class="">       <span id="DivID_21631_4140_High" class="cell-data">40.00</span>      </td>
        <td data-sel="Offer" class="">       <span id="DivID_21631_4140_Offer" class="cell-data">36.80</span>      </td>
        <td data-sel="OfrQty" class="">       <span id="DivID_21631_4140_OfrQty" class="cell-data">1,852</span>      </td>
        <td data-sel="BidPrice">       <span id="DivID_21631_4140_BidPrice" class="cell-data">36.60</span>      </td>
        <td data-sel="BidQty" class="primary">       <span id="DivID_21631_4140_BidQty" class="cell-data">102,791</span>      </td>
        <td data-sel="TradedVol" class="">       <span id="DivID_21631_4140_TradedVol" class="cell-data">2,766,332</span>      </td>
        <td data-sel="Traded" class="">       <span id="DivID_21631_4140_Traded" class="cell-data">3,818</span>      </td>
        <td data-sel="Time" class="">       <span id="DivID_21631_4140_Time" class="cell-data">15:29:54</span>      </td>
        <td data-sel="Prcnt" class="changedowntdcssclass">       <span id="DivID_21631_4140_Prcnt" class="cell-data">-6.75%</span>      </td>
        <td data-sel="Change" class="changedowntdcssclass">       <span id="DivID_21631_4140_Change" class="cell-data">-2.61</span>      </td>
        <td data-sel="LastQty" class="">       <span id="DivID_21631_4140_LastQty" class="cell-data">651</span>      </td>
        <td data-sel="Company">       <span id="DivID_21631_4140_Company" class="cell-data">الصادرات</span>      </td>
        <td data-sel="Symbol">       <span id="DivID_21631_4140_Symbol" class="cell-data">4140</span>             </td>
    </tr>
</tbody>

排序仅适用于多个列(仅使用以下'data-sel'值): -

  • 符号
  • 公司
  • BidQty
  • BidPrice

所以这可能是魔法,也可能是魔术......除非有一些隐藏的解释可用!!!

正如您所看到的,Bid&amp;商品列具有相同的值,说实话,它是格式化的数量或所有列的价格!!

tablesorter自动列检测已经检测到所有这些都是'数字',我尝试使用货币进行解析,但是完全相同......它根本不排序!我因为它而疯了!!!!

提前致谢

1 个答案:

答案 0 :(得分:0)

嗯......似乎触发$(table).trigger('update')帮助它......真可惜!排序不会触发table.update !!!!!!!!!!!

无论如何,我有一个500毫秒的间隔来继续触发桌面上的“更新”,因为我的真实数据在1秒内被多次更新。

我希望这可以帮助任何人,以及寻求者,检查为什么在某些专栏而不是其他专栏上发生这种情况!