gpt4 book ai didi

javascript - 重新加载 Bootstrap 表刷新并更改设置

转载 作者:行者123 更新时间:2023-11-28 15:19:30 26 4
gpt4 key购买 nike

我目前正在尝试根据存储在 localStorage 中的一些用户配置动态更改 Bootstrap 表的配置并重新加载它。

表格在页面加载时填充,但某些事件可以在页面内部触发并根据用户设置更改其配置。

我看了一下official documentation,some questions在SO中。我尝试这样做,如下所示:

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

(出于测试目的,从上面的代码中删除了 localstorage.getItem block 和规则。)

这是我的表格代码(请注意,某些元素是葡萄牙语):

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

该代码不起作用。该表不会刷新,并且代码不会生成任何错误。我看了一下some examples ,找不到我哪里出错了。那么,如何动态更改 Boostrap 表设置呢?上面的代码我做错了什么?

注意:我正在使用Bootstrap 3 .

最佳答案

试试这个:

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

关于javascript - 重新加载 Bootstrap 表刷新并更改设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32120469/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com