twitter-bootstrap Bootstrap 的下拉菜单与 Datatables 不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26155930/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap's dropdown with Datatables not working
提问by Naumche Ivanovski
Can you please help me i have Bootstrap`s dropdown button to end of Datatable but when i clicked on it it is not working menu is not shown
你能帮我吗 我有 Bootstrap 的下拉按钮到数据表的末尾但是当我点击它时它不工作 菜单没有显示
<div class="btn-group dropdown">
<button class="btn btn-default dropdown-toggle" aria-haspopup="true" aria-expanded="false">Action <span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="">Edit</a></li>
<li><a href="">Delete</a></li>
<li class="divider"></li>
<li><a href="">Separated link</a></li>
</ul>
</div>


回答by Martin Varta
I added
我加了
$('body .dropdown-toggle').dropdown();
And works for me.
并对我来说有效。
回答by Ole Haugset
The correct formatting of a bootstrap dropdown menu according to their website is:
根据他们的网站,引导程序下拉菜单的正确格式是:
<div class="dropdown">
<a data-toggle="dropdown" href="#">Dropdown trigger</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
...
</ul>
</div>
It also depends on the bootstrap.js file being included on your page, so make sure that you have this.
它还取决于页面中包含的 bootstrap.js 文件,因此请确保您拥有该文件。
Source:
来源:

