FixedHeader

FixedHeader

MaddyMaddy Posts: 24Questions: 0Answers: 0
edited April 2012 in General
I'm trying to add fixedheader feature to my datatable. I added the following statement: new FixedHeader( oTable);

A floating header got created on top of the original header. The header had transparent background with a font and style different from my existing header. It looks very odd when the floating header overlaps on the current header.

Can anyone help with this issue?

Datatable initialization:

oTable = $('#mydataTable').dataTable({
"aaSorting": [ [0,'asc'] ],
"aoColumns" : dataTableColumns,
"oLanguage": {
"sLengthMenu": 'Show '+
'10<\/option>'+
'25<\/option>'+
'50<\/option>'+
'100<\/option>'+
'All<\/option>'+
'<\/select> records'
},
"iDisplayLength": -1,
});
new FixedHeader( oTable);

CSS code:

table.display thead th {
padding: 3px 18px 3px 10px;
border-bottom: 1px solid black;
font-weight: bold;
cursor: pointer;
}

table.display tfoot th {
padding: 3px 10px;
border-top: 1px solid black;
font-weight: bold;
}

table.display tr.heading2 td {
border-bottom: 1px solid #aaa;
}

Replies

  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin
    You just need to adda little bit of CSS to address that:

    [code]
    .FixedHeader_Cloned th { background-color: white; }
    [/code]

    It isn't done automatically, because white might not be your background colour.

    Allan
  • MaddyMaddy Posts: 24Questions: 0Answers: 0
    Thanks a lot Allan. I now styled the header as per my existing header.
  • MaddyMaddy Posts: 24Questions: 0Answers: 0
    One more thing, is there a way using which I can resize the fixed header dynamically? I have a double click feature in my existing datatable in which when I double click the row, the row expands to form text areas. In that case, I need my fixed header to expand as well. Here is my double click feature:

    $("[id^='abc']").bind('dblclick', function() {
    var tmp1 = this.id.substr(0, this.id.lastIndexOf("_"));
    var row1 = tmp1.substr(tmp1.lastIndexOf("_") + 1);
    editrow(row1);
    });
  • MaddyMaddy Posts: 24Questions: 0Answers: 0
    Allan, with FixedHeader plugin, can I have horizontal scrolling? What I mean to say is, with FixedHeader in place, when I scroll horizontally, the header is not scrolling as per the data.. until I scroll (horizontally) to the end of the page. Please advise? Thanks!!
This discussion has been closed.