Fixed data table height
Fixed data table height
woutersteven
Posts: 8Questions: 0Answers: 0
Good day all,
I'm very pleasantly surprised with Data Tables, however have two questions that I couldn't find an answer to in the examples.
1. Is it possible to set a fixed height to the table, for example 250 pixels or 10 rows, so that when there are less than 10 rows, the table size remains the same and doesn't resize to smaller?
2. Is it possible to disable sorting for certain columns?
Sincerely,
- Wouter van der Schagt
I'm very pleasantly surprised with Data Tables, however have two questions that I couldn't find an answer to in the examples.
1. Is it possible to set a fixed height to the table, for example 250 pixels or 10 rows, so that when there are less than 10 rows, the table size remains the same and doesn't resize to smaller?
2. Is it possible to disable sorting for certain columns?
Sincerely,
- Wouter van der Schagt
This discussion has been closed.
Replies
1. Yes - just use a little bit of CSS to do this: .dataTables_wrapper { min-height: 250px; }
2. Yes - use bSortable : false
Allan
I am currently adjusting the CSS, to have a 100% height of the rows container, perhaps it could help you :
CSS
[code]
html,body {margin:0;padding:0;overflow:hidden;height:100%;}
#main_div_container {width:100%;position:relative;height:100%;margin:auto;}
#yourDataTable_container {position:absolute;top:0px;bottom:0px;left:0px;right:0px;}
#yourDataTable_ID {padding-bottom:30px;}
.dataTables_wrapper {position:absolute;top:40px;bottom:0px;left:0px;right:0px;}
.dataTables_scrollHead {position:relative;top:0px;}
.dataTables_scrollBody {position:absolute;top:56px;bottom:0px;}
.dataTables_scrollFoot {position:absolute;bottom:14px;background-color:#(your background color);padding-bottom:2px;}
[/code]
HTML
[code]
...
...
[/code]