Noob asks daft Q
Noob asks daft Q
Hi,
I have been messing with datatables for a couple of days now. I must say I'm very impressed with what it can do. I have it set up on some tables that need pagination, filtering etc - and it works a charm.
My question is this: Is there a way to slap the datatables style on a generic html table that does not need any filtering, searching, pagination, or any other type of fancy manipulation. Simply a table with a few tr's, and td's. The reason I am asking, is that I have some tables set up on a page, and there seems to be a set height for a datatable, leaving a lot of empty space underneath each table. With a simple way to just have the nice style applied, and otherwise just render html as normal, that would solve my problem. Any hints are much appreciated, and thank you very much!
Cheers,
Joe
PS. I am using the jQuery UI style...
I have been messing with datatables for a couple of days now. I must say I'm very impressed with what it can do. I have it set up on some tables that need pagination, filtering etc - and it works a charm.
My question is this: Is there a way to slap the datatables style on a generic html table that does not need any filtering, searching, pagination, or any other type of fancy manipulation. Simply a table with a few tr's, and td's. The reason I am asking, is that I have some tables set up on a page, and there seems to be a set height for a datatable, leaving a lot of empty space underneath each table. With a simple way to just have the nice style applied, and otherwise just render html as normal, that would solve my problem. Any hints are much appreciated, and thank you very much!
Cheers,
Joe
PS. I am using the jQuery UI style...
This discussion has been closed.
Replies
[code]
$(document).ready(function() {
$('#example').dataTable( {
sDom: '<"H">t<"F">',
iDisplayLength: 9999,
aoColumnDefs: [ { aTargets: [0,1,2,3,4,5,6,7], bSortable: false, bSearchable: false } ]
});
});[/code]
Screen shot:
http://belmaati.com/pics/flightdetails.jpg
Looks like this:
http://belmaati.com/pics/flightdetails2.jpg
I am not sure where to look for those, and how their height is set..? Is there a way to "unset" it?
you might want to set sScrollY to something suitable (but this will force really tall tables to scroll. is that ok?) and bScrollCollapse and see if that helps. http://datatables.net/ref#bScrollCollapse
[code]
$(document).ready(function() {
$('#example').dataTable( {
"sScrollY": "200",
"bScrollCollapse": true
} );
} );[/code]
EDIT: Just tried your code example. This causes the table to scroll internally but does not get rid of the white space after the table..
http://belmaati.com/pics/flightdetails3.jpg
Once again, thanks for any help!
[code]
.dataTables_wrapper {
position: relative;
min-height: 150px;
_height: 150px;
clear: both;
}
[/code]
All the best,
Joe
I should add the .css() function to the blog entry, since it's a good common one.