[英]bootstrap-table: disable sorting on a row
Is there any way to disable sorting on a specific row using the bootstrap-table
library? 有什么方法可以使用
bootstrap-table
库禁用特定行的排序吗? The reason is my last row is a "Totals" row and I obviously want that to be the last row in every situation. 原因是我的最后一行是“总计”行,我显然希望在每种情况下都将其作为最后一行。
http://jsfiddle.net/e3nk137y/11389/ http://jsfiddle.net/e3nk137y/11389/
It looks like this functionality is incorporated into this bootstrap-sortable
library by setting the data-disable-sorting
attribute to true
on the <tr>
element you want to disable ( here ). 它看起来像这样的功能合并到这个
bootstrap-sortable
库通过设置data-disable-sorting
属性true
的上<tr>
要禁用(元素在这里 )。 Perhaps it's best to use this library on top of bootstrap-table
if this isn't available in bootstrap-table
? 也许这是最好的使用这个库的顶部
bootstrap-table
,如果这是不具备的bootstrap-table
?
Figured this out. 想通了。 You can't disable sorting on any specific row (at the moment);
您目前无法在任何特定行上禁用排序; however, you can add a footer row which locks it in to the bottom most row at all times.
但是,您可以添加页脚行,始终将其锁定在最底部的行中。 You just need to add
data-show-footer="true"
to the <table>
element. 您只需要向
<table>
元素添加data-show-footer="true"
。
To add values to a column you need to add the data-footer-formatter
attribute to the respective <th>
element and set that equal to a javascript function, which can be as simple as function myTotal(data){ return '100' }
. 要将值添加到列,您需要将
data-footer-formatter
属性添加到相应的<th>
元素,并将其设置为等于javascript函数,该函数可以与function myTotal(data){ return '100' }
一样简单。
You can also style the footer by adding the data-footer-style
to the <table>
element and, again, setting that equal to a javascript function. 您还可以通过将
data-footer-style
到<table>
元素,然后再次将其设置为javascript函数来设置data-footer-style
。
See my answer here for a good, basic example: Is it possible to fix <footer> in bootstraptable? 参见我的回答,这里有一个很好的基本示例: 是否可以在bootstraptable中修复<footer>?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.