本文介绍: 列数行数 过多 不分页的情况下 增加水平滚动垂直滚动;首先:确定一个容器大小 数据展示在容器中,除了固定数据不动 其他的都可以通过滚动条进行查看

例如

 不管垂直滚动条怎么滚动  (蓝色表头表头始终在不动;

列数过多时除了左侧固定的列  其他列通过水平滚动条进行滚动


<style>
        .table-responsive{
            width: 100%;
        }
</style>
<div class="col-sm-12 select-table table-bordered table-responsive"  style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
        <div class="fakeContainer" >
            <table id="bootstrap-table"&gt;</table&gt;
        </div&gt;
</div&gt;
css:定义最外层div宽度
 var options = {
        url: prefix + "/getData",
        modalName: "xxx",
        fixedColumns: true,//是否固定fixedNumber:3,//固定几列
        striped:true,
        pagination:false,//不分页
        showSearch:false,
        showColumns:false,
        showToggle:false,
        showRefresh:false,
        height:700 //加入这个固定表头
    };

加入height  固定表头 上下滚动表头一直在最上方

效果

 大功告成!!!

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注