簡體   English   中英

重新加載引導表刷新並更改設置

[英]Reload bootstrap table Refresh and change settings

我目前正在嘗試根據存儲在localStorage中的一些用戶配置動態地更改引導表的配置,然后重新加載它。

該表會在頁面加載時填充,但是某些事件可能會在頁面內觸發並根據用戶設置更改其配置。

我看了一下官方文檔以及SO中的一些 問題 我嘗試這樣做,如下所示:

var $table = $('#grd-fatura');        
$table.bootstrapTable('refresh', {
    pageSize: 2
});

(出於測試目的,已從上述代碼中刪除了localstorage.getItem塊和規則。)

這是我的表代碼(請注意,某些元素是葡萄牙語):

<table 
    id="grd-fatura" data-click-to-select="true" data-response-handler="responseHandler"
    data-pagination="true" @*data-height="460"*@ data-show-footer="true" data-search="true" 
    data-show-columns="true" data-cache="false" data-show-toggle="true" data-show-export="true">
    <thead>
        <tr>
            <th data-field="state" data-checkbox="true"></th>
            <th data-field="ID" data-unique-id="ID" data-align="left" data-visible="false" data-sortable="true">Código</th>
            <th data-field="estabelecimento" data-align="left" data-sortable="true">Estabelecimento</th>
            <th data-field="historico" data-align="left" data-sortable="true">Histórico</th>
            <th data-field="tipo" data-align="left" data-sortable="true">Tipo</th>
            <th data-field="pessoa" data-align="left" data-sortable="true">Pessoa</th>
            <th data-field="emissao" data-align="center" data-sortable="true">Emissão</th>
            <th data-field="referencia" data-align="left" data-sortable="true">Referência</th>
            <th data-field="situacao" data-align="left" data-sortable="true">Situação</th>
            <th data-field="total" data-align="right" data-sortable="true" data-footer-formatter="Totalizador">Total</th>
        </tr>
    </thead>
</table>

該代碼不起作用。 該表不會刷新,並且代碼不會產生任何錯誤。 我看了一些示例 ,但找不到我要去哪里。 那么,如何動態更改Boostrap表設置? 我在上面的代碼中做錯了什么?

注意:我正在使用Bootstrap 3

嘗試這個:

$table.bootstrapTable('refresh', {
    query: {pageSize: 2}
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM