首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Bootstrap-table动态更改表高度

Bootstrap-table动态更改表高度
EN

Stack Overflow用户
提问于 2015-02-07 18:17:37
回答 1查看 10.5K关注 0票数 5

我在1.6版本中使用Bootstrap-table插件。我想动态改变桌子的高度--可以吗?我不知道该怎么做...

代码语言:javascript
复制
<div class="main">
    <button id="resetView" class="btn btn-default">Reset View</button>

    <table id="table"
           data-toggle="table"
           data-url="/gh/get/response.json/wenzhixin/bootstrap-table/tree/master/docs/data/data1/"
           data-height="200">
        <thead>
        <tr>
            <th data-field="name">Name</th>
            <th data-field="stargazers_count">Stars</th>
            <th data-field="forks_count">Forks</th>
            <th data-field="description">Description</th>
        </tr>
        </thead>
    </table>

代码语言:javascript
复制
$(function () {
    setTimeout(function () {
        $('.main').width('80%'); // Change table width

        $('.main').height('100'); // it won't work
        $('#table').data('height', 100); // this also won't work
        $('#table').height('100'); // and of course this won't work..
    }, 1000);

    $('#resetView').click(function () {
        $('#table').bootstrapTable('resetView');
    });
});

working fiddle http://jsfiddle.net/e3nk137y/558/

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-02-07 18:48:30

最后,让它工作了.

代码语言:javascript
复制
$('#table').bootstrapTable( 'resetView' , {height: 200} );
票数 13
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28380957

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档