简体   繁体   中英

bootstrap-table: disable sorting on a row

Is there any way to disable sorting on a specific row using the bootstrap-table library? 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/

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 ). Perhaps it's best to use this library on top of bootstrap-table if this isn't available in 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.

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' } .

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.

See my answer here for a good, basic example: Is it possible to fix <footer> in bootstraptable?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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