【发布时间】:2014-09-13 10:55:59
【问题描述】:
我遇到了与这里提出的相同的问题:
jQuery Datatables Column list rendering behind the jQuery Modal Dialog
我在 Bootstrap 模式窗口中有一个 DataTables 表,我正在尝试使用 DataTables 的 ColVis 扩展来使列可选。当我单击模式上可见的“显示列”按钮时,什么也没有出现。但是,当我关闭模式时,我发现列列表中的每列都有一个复选框,位于模式后面。
ColVis 选择面板需要在模态框顶部可见,并且需要与模态框一起出现。
我在 ColVis.css 文件中的三个位置更改了 z-index 属性,将每个位置乘以 10:
div.ColVis_collectionBackground {
background-color: black;
/*z-index: 1100;*/
z-index: 11000;
}
div.ColVis_collection {
position: relative;
width: 150px;
background-color: #f3f3f3;
padding: 3px;
border: 1px solid #ccc;
/*z-index: 1102;*/
z-index: 11020
}
div.ColVis_collection button.ColVis_Button {
background-color: white;
width: 100%;
float: none;
margin-bottom: 2px;
}
div.ColVis_catcher {
position: absolute;
/*z-index: 1101;*/
z-index: 11010;
}
(原来的值被注释掉了。)
这些改动对我来说似乎足够了,但没有任何效果。 Bootstrap 模态的 z-index 值可在名为 bootstrap.css 的文件中找到。这是课程:
.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1040;
display: none;
overflow: auto;
overflow-y: scroll;
}
有人知道我需要做什么吗?
【问题讨论】:
-
我不能帮助你(除非你创建一个重现问题的小提琴)因为我们不知道实际的设置,但这听起来像一个典型的stacking order issue。这里有很多注入的 z 顺序元素。除了模态本身之外,Bootstrap 模态还具有背景。除了菜单本身,Colvis 还有背景。
-
你能解决吗?我有同样的问题
标签: jquery twitter-bootstrap datatables