我在用
<th class="none"></th>
若要隐藏datatable表中的最后一列,请执行以下操作。Datatable在第一列中创建一个按钮,以在子行中显示/隐藏该列。此按钮的颜色在responsive.bootstrap.min.css中设置:
table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child:before{ background-color:#5d9cec }
我在第一列中添加了一个自定义类,以便根据行中的数据禁用按钮:
.not-active { pointer-events: none; cursor: default; }
根据特定行的内容,通过C#设置类。
<tr><td class='<%# DisableLink(Eval("InvoiceDate").ToString()) %>'><%# Eval("InvoiceNumber")%></td>
这一切都如期而至。
我现在要做的是,当td的类设置为.non-active时,将按钮的背景色设置为灰色,而不是写背景色。
我试过了
.not-active > table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child:before{ background-color:#5d9cec }
和十几种不同的组合,但似乎不能得到正确的格式。
有什么建议吗?谢谢!
根据请求添加FSFiddle:https://jsfiddle.net/yk06fbxa/3/
发布于 2016-12-28 11:14:18
设置背景色的CSS规则是
table.dataTable.dtr-inline.collapsed tbody td:first-child:before,
table.dataTable.dtr-inline.collapsed tbody th:first-child:before {
...
background-color: #31b131;
}
要在<td>
具有类not-active
时重写它,您可以这样修改它:
table.dataTable.dtr-inline.collapsed tbody td.not-active:first-child:before,
table.dataTable.dtr-inline.collapsed tbody th.not-active:first-child:before
{
background-color:#dddddd;
}
参见演示这里。我已经将第一行的td设置为没有not-active
类,以确保它只适用于.not-active
类。
https://stackoverflow.com/questions/41367876
复制