javascript Jquery 数据表主题隐藏页眉/页脚
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21047740/
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
Jquery Datatable theme Hide header/footer balk
提问by user2911924
I am trying to remove the header/footer balk of this table
我正在尝试删除此表的页眉/页脚
Picture of what I am trying to remove:
我试图删除的图片:
The Jquery code of this table:
该表的Jquery代码:
$(document).ready(function() {
var oTable = $('#tableSmooth').dataTable({
"bFilter": false, //Disable search function
"bJQueryUI": true, //Enable smooth theme
"sPaginationType": "full_numbers" //Enable smooth theme
});
});
Hope someone can help!
希望有人能帮忙!
回答by Sangeet Menon
I am not able to view the image, But I am assuming that you want only to display the table and remove the search,paging and info features..
我无法查看图像,但我假设您只想显示表格并删除搜索、分页和信息功能..
Add the following attribute in the dataTable declaration
在 dataTable 声明中添加以下属性
"sDom": 't'
Some thing like this
像这样的事情
$(document).ready(function() {
var oTable = $('#tableSmooth').dataTable({
"bFilter": false, //Disable search function
"bJQueryUI": true, //Enable smooth theme
"sPaginationType": "full_numbers", //Enable smooth theme
"sDom": 't'
});
});
To get Back replace twith lfrtip
回来用lfrtip替换t
"sDom": 'lfrtip'
To display some of the features use it as
要显示某些功能,请将其用作
"sDom": '<"fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"
lfr>
t<"fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"
ip>'
"sDom": '<"fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"
LFR >
Ť <"fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"
IP>'
l= Length changing
f= Filtering input
r= pRocessing
t= Table
i= Info
p= Pagination
l=长度变化
f= 过滤输入
r= pProcessing
t=表
我=信息
p= 分页
Have a look at dataTables sDom Optionsfor more details
查看dataTables sDom 选项了解更多详情
回答by maco
via js:
通过js:
$(document).ready(function() {
var oTable = $('#tableSmooth').dataTable({
"bFilter" : false,
"bJQueryUI" : true,
"sPaginationType" : "full_numbers",
"bPaginate": false,
"bInfo": false
});
});
or via css:
或通过CSS:
/* these classes are generated by 'jquery.dataTables.js' */
.dataTables_length,
.dataTables_filter,
.dataTables_info,
.dataTables_paginate {
display:none;
}
回答by yeyene
You can set bJQueryUI
to false
, this will take out the balk part of header and footer.
您可以设置bJQueryUI
为false
,这将去掉页眉和页脚的部分。
$(document).ready(function() {
var oTable = $('#tableSmooth').dataTable({
"bFilter": false, //Disable search function
"bJQueryUI": false, //Enable smooth theme
"sPaginationType": "full_numbers" //Enable smooth theme
});
});
回答by David Bigelow
$('tfoot').remove();
$('tfoot').remove();
Removes the footer row. Which is something I was stumped by for some time.
删除页脚行。这是我被难住了一段时间的事情。
回答by The Java Guy
oTable = $('#datatable').dataTable({
bJQueryUI: true,
bFilter: false,
bInfo: false,
bPaginate: false,
sDom: 't'
});
This will remove search bar, pagination, header and footer.
这将删除搜索栏、分页、页眉和页脚。
回答by gmeiner.m
Hide the pagination with:
隐藏分页:
$(document).ready(function() {
var oTable = $('#tableSmooth').dataTable({
"bFilter": false, //Disable search function
"bJQueryUI": true, //Enable smooth theme
"sPaginationType": "full_numbers", //Enable smooth theme
"bPaginate": false //hide pagination
});
});
hope this helps!
希望这可以帮助!
回答by WhiteFang
I am not familiar with jquery but shouldn't you just set style="display: none;"
or style="visibility: hidden;"
or remove it with the DOM by using removeChild (normal javascript). And maybe you could use first and last sibling to select header and footer (just a bunch of ideas, sorry to do it this way can't comment yet :)
我不熟悉的jQuery,但你不应该只是设置style="display: none;"
或者style="visibility: hidden;"
或通过使用removeChild之(普通的JavaScript)的DOM将其删除。也许您可以使用第一个和最后一个兄弟姐妹来选择页眉和页脚(只是一堆想法,很抱歉以这种方式这样做还不能发表评论:)
回答by icecold_bluesea
Try the below! Hope that helps!
试试下面的!希望有帮助!
$(document).ready(function() {
var oTable = $('#tableSmooth').dataTable({
"bFilter" : false, //Disable search function
"bJQueryUI" : true, //Enable smooth theme
"sPaginationType" : "full_numbers", //Enable smooth theme
"bFilter" : false,
"bInfo" : false
});
});