2011-10-14 25 views
3

我在這裏看到這個話題,但它並沒有解決我的問題。Tablekit:排序不工作,如果表格行加載ajax

我有一個表格,在html中看起來像這樣;

<table class="sortable resizable editable" id="tablekit-table-1"> 
    <thead> 
    <tr> 
      <th id="order_orders" class="sortfirstdesc sortcol sortdesc">Order</th> 
     </tr> 
    </thead> 


    <tfoot> 
    </tfoot> 

    <tbody id="orders_content"> 
     <?php //data generated by ajax ?> 
    </tbody> 


</table> 

在頁面加載時,行通過ajax加載到tbody中。

問題是,tablekit的排序不能從那裏工作(只有當我輸出php的行)。

我試着在阿賈克斯成功加入setTimeout(),重新初始化表

TableKit.Sortable.init('tablekit-table-1') 

等,沒有任何幫助。谷歌搜索很多。提前致謝。

回答

1

我有同樣的問題。我找到的解決方案是使用onOccess上的Tablekit.Sortable.init(id)

但是我仍然遇到另一個問題:它只能在第一個調用中工作,所以我爲每個調用的表放置了一個不同的id,然後在這個新的id上初始化Sortable。