Strange Issue With Fixed Header
Strange Issue With Fixed Header
jamessteelforth
Posts: 17Questions: 4Answers: 0
Hi All, recently my boss asked me to implement the fixed header plug-in for datatables plug-in in salesforce. Now The way my code is designed is that every time search button is clicked i have a callback function to the db as well as an oncomplete function re-initializing the data tables.
Looking at the sample code for fixed headers i put the call to the function ' new FixedHeader( oTable );' inside the initialization block. Instaed of getting re-initialized every time, the header is getting created again and again. So with each call i have a new floating header plus the old one in some misplaced corner as well, how do i change this??
[code]
function Kudos()
{
oTable = $('.datatable').dataTable(
{
"iDisplayLength": 100,
"sDom": '<"H"T><"clear"><"H">t<"F"ip>',
"bRetrieve": true,
"aoColumnDefs": [ {
"aTargets": [3,4,5,6,7,8,9,10],
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
if ( sData < "0" ) {
$(nTd).css('color', 'red')
$(nTd).css('font-weight', 'bold')
}
}
} ],
"oTableTools":
{
"sSwfPath": "{!$Resource.SWF_File}",
"aButtons": [
{
"sExtends": "csv",
"sFileName": "PortFolio.csv",
"sButtonText":"Export"
}, "print" ]
},
"oColVis":
{
"activate": "mouseover"
},
"bAutoWidth": false,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aaSorting": [[ 2, "asc" ]] ,
"bLengthChange": false,
"bFilter": true,
"aoColumns": [
{ "sWidth": "6%" },
{"sWidth": "6%"},
{"sWidth": "6%"},
{ "sWidth": "6%" },
{"sWidth": "6%"},
{"sWidth": "6%"},
{ "sWidth": "6%" },
{"sWidth": "6%"},
{"sWidth": "6%"},
{ "sWidth": "6%" },
{"sWidth": "6%"},
{"sWidth": "6%"},
{ "sWidth": "6%" },
{"sWidth": "6%"},
{"sWidth": "6%"}
]
});
new FixedHeader( oTable );
}
[/code]
Looking at the sample code for fixed headers i put the call to the function ' new FixedHeader( oTable );' inside the initialization block. Instaed of getting re-initialized every time, the header is getting created again and again. So with each call i have a new floating header plus the old one in some misplaced corner as well, how do i change this??
[code]
function Kudos()
{
oTable = $('.datatable').dataTable(
{
"iDisplayLength": 100,
"sDom": '<"H"T><"clear"><"H">t<"F"ip>',
"bRetrieve": true,
"aoColumnDefs": [ {
"aTargets": [3,4,5,6,7,8,9,10],
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
if ( sData < "0" ) {
$(nTd).css('color', 'red')
$(nTd).css('font-weight', 'bold')
}
}
} ],
"oTableTools":
{
"sSwfPath": "{!$Resource.SWF_File}",
"aButtons": [
{
"sExtends": "csv",
"sFileName": "PortFolio.csv",
"sButtonText":"Export"
}, "print" ]
},
"oColVis":
{
"activate": "mouseover"
},
"bAutoWidth": false,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aaSorting": [[ 2, "asc" ]] ,
"bLengthChange": false,
"bFilter": true,
"aoColumns": [
{ "sWidth": "6%" },
{"sWidth": "6%"},
{"sWidth": "6%"},
{ "sWidth": "6%" },
{"sWidth": "6%"},
{"sWidth": "6%"},
{ "sWidth": "6%" },
{"sWidth": "6%"},
{"sWidth": "6%"},
{ "sWidth": "6%" },
{"sWidth": "6%"},
{"sWidth": "6%"},
{ "sWidth": "6%" },
{"sWidth": "6%"},
{"sWidth": "6%"}
]
});
new FixedHeader( oTable );
}
[/code]
This discussion has been closed.
Replies
I've opened a Github issue for this: https://github.com/DataTables/FixedHeader/issues/10
Allan