折雨的天空
bootstrap-table使用固定列,样式错乱的问题
2024-10-20 我好笨


就是通过官方示例来的



地址:https://examples.bootstrap-table.com/#extensions/fixed-columns.html



使用固定属性



data-fixed="true"
data-fixed-columns="true"
data-fixed-number="2"
data-fixed-right-number="1"



引入扩展



<script src="<!--{$basePath}-->views/js/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.js"></script>
<script src="<!--{$basePath}-->views/js/bootstrap-table/extensions/fixed-columns/bootstrap-table-fixed-columns.js?v=1.3" type="text/javascript"></script>



我犯错在没有引入CSS,这个固定列有专用的CSS,所以导致固定列以后,会出现重复行,折腾了好久,最后发现是没有引入CSS



引入如下CSS



<link rel="stylesheet" href="<!--{$basePath}-->views/js/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.css">
<link rel="stylesheet" href="<!--{$basePath}-->views/js/bootstrap-table/extensions/fixed-columns/bootstrap-table-fixed-columns.css">



然后就正常了。

发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容