2017-07-19 10 views
0

複数の行スパンでテーブルを並べ替える方法はありますか?私はこのjsFiddleのプラグインを試していましたが、年齢が正しくソートされていないようです。 rowspansでHTMLテーブルをソートする方法はありますか?このテーブルをrowspanでソートする必要があります。rowspansでテーブルを並べ替える

HTML

<table cellspacing="1" class="tablesorter"> 
    <thead> 
    <tr> 
     <th>First Name</th> 
     <th>Age</th> 
     <th>Country</th> 
    </tr> 
    </thead> 
    <tbody> 
    <tr> 
     <td>Peter</td> 
     <td>28</td> 
     <td rowspan="2" style="vertical-align:middle">AAA</td> 
    </tr> 
    <tr class="expand-child"> 
     <td>John</td> 
     <td>33</td> 
    </tr> 
    <tr> 
     <td>Clark</td> 
     <td>18</td> 
     <td>BBB</td> 
    </tr> 

    <tr> 
     <td>Bruce</td> 
     <td>22</td> 
     <td>CCC</td> 
    </tr> 
    </tbody> 
</table> 

JS

$('table').tablesorter(); 

答えて

-1

使用するデータ・テーブル、それはすべての機能があります:https://datatables.net/

$('.tablesorter').DataTable({ 
    "columnDefs": [ { 
    "targets": [ 0, 2 ], 
    "orderable": false 
    } ] 
}); 
0

それはあなた「を展開好きではありません-子"クラス。それを削除すると、それはちょうど良い並べ替えのようです。そのクラスは何をしていますか?

+0

ソートボタンをダブルクリックすると、そのクラスなしで表が破損する – user2896120

+0

列が拡張されていることを意味しますか?それはあなたのtrのcolspanが必要なのですから? – stevelacerda7

関連する問題