jquery datatables change default min-height
Asked Answered
M

3

9

I am using datatables. ( http://datatables.net/ ) I have created a table. There is a height problem I am struggling to change. I checked the table size with firebug. The table height is set 302px by default. I could not find how to change.I tried to change css unsuccessfully. I appreciate, if anyone helps.

from firebug:

.dataTables_wrapper {
    clear: both;
    min-height: 302px;
    position: relative;
}

Thanks in advance.. Ozlem

Meacham answered 9/12, 2010 at 3:27 Comment(3)
@user , are you using jquery ???Filiation
yes I am. can you give me a sample code?Meacham
@user , i gave some reference code//Filiation
F
7

// you can set the any css property through .css like below

$('#id').css('min-height','200');
Filiation answered 9/12, 2010 at 5:0 Comment(1)
this was the answer. I am writing for the ones who experienced the same problem: even if you are using the id and it is not happening, double check the id with FireBug..I was trying to use 'dataTables_wrapper' as id, however the id was a kind of renamed by the API table that I used. it was like data_rulesTables_wrapper or sth similar. Thanks to gov again...Meacham
F
20

Add px after 200.

$('#id').css('min-height','200px');

Hope it saves somebody 10 seconds.

Franciscofranciska answered 20/6, 2011 at 20:43 Comment(0)
F
7

// you can set the any css property through .css like below

$('#id').css('min-height','200');
Filiation answered 9/12, 2010 at 5:0 Comment(1)
this was the answer. I am writing for the ones who experienced the same problem: even if you are using the id and it is not happening, double check the id with FireBug..I was trying to use 'dataTables_wrapper' as id, however the id was a kind of renamed by the API table that I used. it was like data_rulesTables_wrapper or sth similar. Thanks to gov again...Meacham
H
0

Nowadays I would implement sth like this https://datatables.net/reference/option/fixedColumns.heightMatch, in site.js:

$('.dataTables_wrapper').DataTable( {
fixedColumns: {
    heightMatch: 'none'
}});

and in site.css:

td {
line-height: 45px;}
Havre answered 6/9, 2021 at 19:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.