Need help with sWrapper
Need help with sWrapper
I'm trying to set the sWrapper to my own class for styling. I'm using the following (with version 1.7 beta 3):
$(document).ready( function() {
oTable=$('myTable').dataTable({
"sDom": '<"top">ifrt'
,"sWrapper": 'myDtWrapper'
,"bProcessing": true ...
It does not work for me. The default wrapper and my datatable wrapper are defined as:
.dataTables_wrapper {
position: relative;
height: 290px;
clear: both;
overflow-y: auto;
background: white;
}
.myDtWrapper {
position: relative;
height: 100%;
border: 0px;
}
The table always displays with a height of 290px when I'm expecting it to be 100% (i.e., much higher). Is there something obvious that I'm doing wrong here?
$(document).ready( function() {
oTable=$('myTable').dataTable({
"sDom": '<"top">ifrt'
,"sWrapper": 'myDtWrapper'
,"bProcessing": true ...
It does not work for me. The default wrapper and my datatable wrapper are defined as:
.dataTables_wrapper {
position: relative;
height: 290px;
clear: both;
overflow-y: auto;
background: white;
}
.myDtWrapper {
position: relative;
height: 100%;
border: 0px;
}
The table always displays with a height of 290px when I'm expecting it to be 100% (i.e., much higher). Is there something obvious that I'm doing wrong here?
This discussion has been closed.
Replies
sWrapper cannot be set as an initialisation parameter: http://datatables.net/styling/custom_classes
[code]
$.fn.dataTableExt.oStdClasses.sWrapper = "whatever";
[/code]
Allan
How do I use $.fn.dataTableExt.oStdClasses.sWrapper? I can see that I need to set it to my wrapper class, but, where do I do this?
I'm a noob at jQuery and not too good at reading documentation. I still don't get it and without actual code examples I'm pretty much stuck. Sorry for being so dense.
[code]
$.fn.dataTableExt.oStdClasses.sWrapper = "myDtWrapper";
$('#example').dataTable();
[/code]
You set it before you initialise the table, and any of the other default classes you want to customise as well.
Regards,
Allan
[code]$.fn.dataTableExt.oJUIClasses.sWrapper = "myDtWrapper"; [/code]
doesn't confine itself to a particular table, does it?
[code]$.fn.dataTableExt.oJUIClasses.sWrapper = "myDtWrapper"; [/code]
may be declared before each datatable initializer, and will affect tables after it. So,
[code]
//table1 needs class 'table1'
$.fn.dataTableExt.oJUIClasses.sWrapper = "table1";
$('#table-1').dataTable();
[/code]
and the wrapper will inherit the class 'table1' into '#table-2' by default, unless ...
[code]
//table2 needs class 'table2'
$.fn.dataTableExt.oJUIClasses.sWrapper = "table2";
$('#table-2').dataTable();
[/code]