bootstrap-table: 禁用对一行的排序

bootstrap-table: disable sorting on a row

有什么方法可以使用 bootstrap-table 库禁用对特定行的排序吗?原因是我的最后一行是 "Totals" 行,我显然希望它在任何情况下都是最后一行。

http://jsfiddle.net/e3nk137y/11389/

看起来此功能已合并到此 bootstrap-sortable library by setting the data-disable-sorting attribute to true on the <tr> element you want to disable (here) 中。如果 bootstrap-table?

中没有这个库,也许最好在 bootstrap-table 之上使用这个库

想通了。您不能禁用对任何特定行的排序(目前);但是,您可以添加一个页脚行,将其始终锁定在最底部的行中。您只需将 data-show-footer="true" 添加到 <table> 元素。

要向列添加值,您需要将 data-footer-formatter 属性添加到相应的 <th> 元素并将其设置为等于 javascript 函数,这可以很简单function myTotal(data){ return '100' }.

您还可以通过将 data-footer-style 添加到 <table> 元素并再次将其设置为 javascript 函数来设置页脚样式。

请在此处查看我的回答以获得一个很好的基本示例:Is it possible to fix <footer> in bootstraptable?