2012-06-07 26 views
0

我的問題是與此類似:Tablesorter 2.0.3 colspan issue,但我的表的結構是:JQuery的:如何的tablesorter排序表,如果TBODY不符合THEADER

<table id="myTable"> 
<theader> 
    <tr> 
     <th>Reference</th> 
     <th>Description</th> 
     <th>State</th> 
     <th>Description</th>    
    </tr> 
</theader> 
<tbody> 
    <tr> 
     <td colspan="2">111</td>    
     <td colspan="2">Ok</td> 
    </tr>   
</tbody> 

在此表上應用表分揀機後,未正確排序。只有點擊第一個和第二個標題,才能對錶格進行排序。我試圖將Tablesorter 2.0.3 colspan issue的解決方案適用於我的問題,但在jquery插件中出現了錯誤。

但是,如果點擊第一個和第三個標題,應該排序。 也是我一直試圖做的是啓用和禁用標題,如:

$("#myTable").tablesorter({ 
      headers: { 
        0: { 
         sorter: true 
        }, 
        1: { 
         sorter: false 
        }, 
        2: { 
         sorter: true 
        }, 
        3: { 
         sorter: false 
        }, 
}); 

有人可以幫我嗎?謝謝

回答

1

將問題標題組合成一個單元格。

<table id="myTable"> 
<theader> 
    <tr> 
     <th colspan='2'>Reference/Description</th> 
     <th colspan='2'><div>State/Description</th>    
    </tr> 
</theader> 
<tbody> 
    <tr> 
     <td colspan="2">111</td>    
     <td colspan="2">Ok</td> 
    </tr>   
</tbody> 
+0

感謝您的幫助。我已經按照你的建議,但現在我有另一個問題:http://stackoverflow.com/questions/11117662/jquery-table-sorter-stop-sorting – andriy

相關問題