繁体   English   中英

bootstrap -table隐藏除单击的行以外的所有行

[英]bootstrap -table hide all rows except the clicked row

var $table = $('#table');
$table.on('expand-row.bs.table', function (e, index, row, $detail) {
    $detail.html('Carregando os dados...');
});

我想捕获除单击的行以外的所有行,并关闭它们。

我想expand-row是一类...
我还假设您的行的实际display值是table-row ...
但这也可能是inline

尝试这个:

var $table = $('#table');
$table.on("click", '.expand-row.bs.table', function (e, index, row, $detail) {

    $('.expand-row.bs.table').each(function(){  // iterates all rows.
        $(this).css({"display":"none"});        // Here, "this" is row element.
    });

    $(this).css({"display":"table-row"});   // Here, "this" is the clicked element.

    $detail.html('Loading data ...');
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM