【问题标题】:Bootstrap-table change dynamically table heightBootstrap-table 动态改变表格高度
【发布时间】:2015-04-07 11:48:09
【问题描述】:

我在 1.6 版中使用 Bootstrap-table 插件。 我想动态更改表格高度 - 有可能吗?我不知道该怎么做...

<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>

$(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');
    });
});

工作小提琴 http://jsfiddle.net/e3nk137y/558/

【问题讨论】:

    标签: jquery twitter-bootstrap-3 bootstrap-table


    【解决方案1】:

    终于搞定了……

    $('#table').bootstrapTable( 'resetView' , {height: 200} );
    

    【讨论】:

      猜你喜欢
      • 2012-10-22
      • 1970-01-01
      • 2012-11-11
      • 2022-06-18
      • 2012-12-22
      • 1970-01-01
      • 2016-03-07
      • 1970-01-01
      相关资源
      最近更新 更多