2014-03-03 47 views
1

我想知道如何在tablesorter中有一個默認的過濾器值。我有一個參數從一個頁面傳遞到下一個頁面,我希望在搜索框中顯示該參數。我試圖設置的值後的頁面是使用使用JQuery設置頁面加載默認值Tablesorter

$(document).ready(function() { 
     $("#listTable").tablesorter({ headers: {0:{ sorter: 'digit'}}, debug: false, sortList: [[0, 0]], widgets: ['zebra'] }) 
        .tablesorterPager({ container: $("#pager"), positionFixed: false }) 
        .tablesorterFilter({ filterContainer: $("#filter-box"), 
         filterClearContainer: $("#filter-clear-button"), 
         filterColumns: [1, 2, 3, 4], 
         filterCaseSensitive: false 
        }); 
     $('#filter-box').val("${showAccounts}");    
    });; 

這並顯示「過濾盒」輸入內的showAccounts參數準備好了,但它並沒有在頁面加載時進行過濾。有沒有辦法做到這一點?

謝謝!

回答

1

您還需要在頁面加載中觸發filterEnd。添加下面的代碼段應該可以工作。

$("#listTable").trigger("filterEnd"); 
+0

這工作!非常感謝你。 –

相關問題