gpt4 book ai didi

javascript - 侧边栏折叠时数据表标题对齐 : trigger class change

转载 作者:行者123 更新时间:2023-11-28 15:41:36 25 4
gpt4 key购买 nike

我正在使用 datatables激活 scrollY 和 AdminLTE2主题:

acquisitionTable = $('#acquisitionsTable').DataTable({
responsive: true,
// "bLengthChange": false,
deferRender: true,
scrollY: '60vh',
scrollCollapse: true,
scroller: true,

问题是侧边栏折叠时标题对齐

enter image description here

这个问题很普遍,但我尝试过的所有解决方案都失败了。我想调用 acquisitionTable.columns.adjust(); 但我怎样才能捕捉到折叠和展开事件?这是侧边栏:

<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img th:src="@{/static/assets/dist/img/fca.jpg}" class="img-circle"
alt="User Image">
</div>
<div class="pull-left info">
<p sec:authentication="principal.name"></p>
<i class="fa fa-circle text-success"></i> Online
</div>
</div>
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li class="header">MAIN NAVIGATION</li>
<li><a th:href="@{/}"> <i class="fa fa-dashboard"></i> <span>Dashboard</span>
</a></li>
<li sec:authorize="hasRole('ROLE_ADMIN')" class="treeview"><a
href="#"> <i class="glyphicon glyphicon-cog"></i> <span>Administration</span>
<span class="label label-primary pull-right">5</span>
....

当侧边栏折叠时,根据文档(我用 Debug模式检查它)类 .sidebar-collapse 被添加到 body 标签。谢谢

最佳答案

目前我用这段代码解决了问题:

divW = jQuery("#contentAreaId").width();
setInterval(function(){
var w = jQuery("#contentAreaId").width();
if (w != divW) {
acquisitionTable.columns.adjust();
divW = w;
}
},100);

关于javascript - 侧边栏折叠时数据表标题对齐 : trigger class change,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43363828/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com