Javascript 使用导出工具时显示条目下拉菜单消失
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32629949/
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
Show entries dropdown disappear when using export tools
提问by Almis
回答by davidkonrad
You just lack the l
flag in dom
. l
for "length changing input control".
你只是缺少l
的标志dom
。l
用于“长度改变输入控制”。
dom: 'lBfrtip'
will make the dropdown to reappear.
将使下拉菜单重新出现。
updated fiddle -> http://jsfiddle.net/p33x5L3t/1/dom
documentation -> https://datatables.net/reference/option/dom
更新小提琴 -> http://jsfiddle.net/p33x5L3t/1/dom
文档 -> https://datatables.net/reference/option/dom
回答by The Voyager
I know it is too long, but if some one still facing this issue, then please do the following, it is an alternate answer.
我知道它太长了,但是如果有人仍然面临这个问题,那么请执行以下操作,这是一个替代答案。
Add 'pageLength' inside buttons as follows:
在按钮内添加“pageLength”,如下所示:
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
'pageLength','copy', 'csv', 'excel', 'print'
]
} );
回答by Ashvin patidar
This works for me:
这对我有用:
$(document).ready(function(){
dataTable = $('#myDataTable').DataTable({
"processing":true,
"serverSide":true,
dom:'lBfrtip',
buttons: ['excel', 'csv', 'pdf', 'copy'],
"lengthMenu": [50,100,500,1000,2000,5000,10000,50000,100000],
"order":[],
"sScrollX": "100%",
"scrollCollapse": true,
"ajax":{
url:"FetchAllAjax.php",
type:"POST"
}
});
});