我刚刚发现了数据表搜索面板,但对样式印象太深刻了。我已经搜索了应用样式的文档,但无法使其工作:
var tblItems = $("#itemsTable").DataTable({
jQueryUI: true,
data: [],
dom: 'Bfrtip',
buttons: [
{
extend: 'searchPanes',
config: {
//dtOpts: {
columns: [0, 1, 2, 5 ],
layout: 'columns-4',
hideCount: false,
info: false,
controls: true,
cascadePanes: false,
className: 'myCustomClass'
}
},除了检查搜索面板(dtsp-xxx)中使用的类并覆盖它们之外,我如何将样式应用于面板(font-size,color,bootstrap classes,...)?
我给myCustomClass设置了一些可笑的东西,比如粗大的红色边框和青色背景色,这样就可以很容易地看到它是否被应用了。
发布于 2020-10-22 09:15:44
你能做的有些有限--但这可能会有所帮助:
我在我的DataTable中添加了以下内容:
columnDefs:[{
searchPanes:{
className: 'myCustomClass'
},
targets: '_all'
}]这会将类名称添加到搜索窗格中的每个面板中。
然后我添加了一个非常基本的风格:
<style>
.myCustomClass div.dataTables_scroll {
border-style: solid;
border-color: red;
border-width: 1px;
}
</style>这将定位每个窗格中的可滚动区域:

以下是几个注意事项:
,
columnDefs值上。这是可行的,但也有可能有更好的方法。https://stackoverflow.com/questions/64473310
复制相似问题