Bootstrap-таблица динамически меняет высоту таблицы

Я использую плагин Bootstrap-table в версии 1.6. Я хочу динамически изменять высоту таблицы - возможно ли это? Я не могу понять, как это сделать...

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


person breq    schedule 07.02.2015    source источник


Ответы (1)


Наконец-то заработало...

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