簡體   English   中英

覆蓋引導程序表檢查的行背景色

[英]Override bootstrap-table checked row background color

我正在使用jQuery bootstrap-table插件,我需要更改選中行的顏色並在未選中時恢復原始顏色。 這個小提琴https://jsfiddle.net/1yvr1kun/4/顯示了單擊事件時如何執行此操作。 我試圖在檢查事件上實現該想法,但是選中的行不會以設置的顏色突出顯示。 這是我的小提琴http://jsfiddle.net/amotha/e3nk137y/9186/如何在已檢查的行上進行更改並在未檢查的情況下進行更改?

HTML:

<table id="table" data-toggle="table"
       data-url="/gh/get/response.json/wenzhixin/bootstrap-table/tree/master/docs/data/data1/"
       data-click-to-select="true"
       data-single-select="false">
    <thead>
    <tr>
        <th data-field="state" data-checkbox="true"></th>
        <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>

JS:

$('#table').on('click-row.bs.table', function (e, row, $element) {
        $('.success').removeClass('success');
        $($element).addClass('success');
});

CSS:

.success td{
    background-color:red !important;
}

只需在CSS上更改類名

.success td{
    background-color:red !important;
}

.selected td{
    background-color:#b1d54f !important;
}

http://jsfiddle.net/e3nk137y/9196/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM