1
最近,我的老闆問我如何在salesforce中實現datatables插件的固定頭文件插件。Datatables中的多個固定頭文件
我的代碼設計的方式是,每次搜索按鈕被點擊時,我都有一個回調函數到數據庫以及一個oncomplete函數重新初始化數據表。
看看固定頭文件的示例代碼,我把調用函數new FixedHeader(oTable);
放在初始化塊裏面。而不是每次重新初始化,頭部一次又一次地被創建。所以每次打電話時,我都會有一個新的浮動標題以及一些錯位的角落中的舊標題,我該如何改變它?
function Kudos()
{
oTable = $('.datatable').dataTable({
"iDisplayLength": 100,
"sDom": '<C><"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);
}