简体   繁体   English

重新加载引导表刷新并更改设置

[英]Reload bootstrap table Refresh and change settings

I'm currently trying to change on a bootstrap table it's configurations dynamically, based on some user configurations stored in localStorage and reload it. 我目前正在尝试根据存储在localStorage中的一些用户配置动态地更改引导表的配置,然后重新加载它。

The table is filled at page load, but some events can fire inside the page and change it's configuration based on user settings. 该表会在页面加载时填充,但是某些事件可能会在页面内触发并根据用户设置更改其配置。

I took a look at the official documentation, and some questions in SO. 我看了一下官方文档以及SO中的一些 问题 And I tried to do it, as below: 我尝试这样做,如下所示:

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

(The localstorage.getItem block and rules were removed from above code for testing purposes.) (出于测试目的,已从上述代码中删除了localstorage.getItem块和规则。)

And here is my table code (note that some elements are in portuguese): 这是我的表代码(请注意,某些元素是葡萄牙语):

<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>

The code does not work. 该代码不起作用。 The table does not refresh, and the code does not generate any errors. 该表不会刷新,并且代码不会产生任何错误。 I took a look at some examples , and could not find where I am going wrong. 我看了一些示例 ,但找不到我要去哪里。 So, how do I dynamically change the Boostrap table settings? 那么,如何动态更改Boostrap表设置? What I am doing wrong in the above code? 我在上面的代码中做错了什么?

Note: I am using Bootstrap 3 . 注意:我正在使用Bootstrap 3

Try this: 尝试这个:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM