DataTables Column Filter Add-on with dynamic Columns

DataTables Column Filter Add-on with dynamic Columns

DAKODAKO Posts: 1Questions: 0Answers: 0
edited May 2012 in DataTables 1.9
I want to use this Add-On but it dosn't work!
here is my code example!!
[code]
function CreateProductTable(TableHeader, ProductTable) {
var aColums = [];
var aVisible = [];

var aColumnIndex = [];
if (TableHeader != null) {

for (var i = 0; i < TableHeader.length; i++) {
var jColums = {
sTitle: '',
sType: '',
bVisible: true
};

jColums.sTitle = TableHeader[i].Parameter;
var iDatenTyp = TableHeader[i].DataType;
switch (iDatenTyp.toUpperCase()) {
case "char":
case "1":
//is a character
jColums.sType = '';
break;
case "number":
case "0":
//is a number
jColums.sType = 'numeric-comma';
break;
}
var sColVis = TableHeader[i].ColumnVisible;
if (sColVis.toLowerCase() == "false" || sColVis == "0") {
aColumnIndex.push(i);
}
//jColums.bVisible = false;
aColums.push(jColums);
}


jQuery('#CPH_content_HF_HiddenColumns').val('');
jQuery('#CPH_content_HF_HiddenColumns').val(aColumnIndex);


if (TableHeader.length != 0) {
jQuery('#tableproduct').dataTable({
"sScrollY": "200px",
"bJQueryUI": true,
"bLengthChange": false, //show entries
//"sDom": 'FT<"clear">lftFrip', // p = bPaginate, i = bInfo, t = , r =
"iDisplayLength": 20,
"bPaginate": true,
//"sPaginationType": "full_numbers",
"bProcessing": true,
"bSort": true,
"bFilter": true,
"bAutoWidth": false,
"bDestroy": true,
"bInfo": true,
"aaSorting": [],
"aaData": ProductTable,
"aoColumns": aColums, //dynamic TableHeader
"oLanguage": {},
"aoColumnDefs": [
//{ "bSearchable": false, "bVisible": true, "aTargets": [9] }
],
"fnRowCallback": function (nRow, aData, iDisplayIndex) {

for (var i = 0; i < aData.length; i++) {

jQuery('td:eq(' + i + ')', nRow).attr('id', 'CellIndex_' + i + '_RowIndex_' + iDisplayIndex);
jQuery('td:eq(' + i + ')', nRow).parent().attr('id', 'RowIndex_' + iDisplayIndex);
}
return nRow;
},
"fnDrawCallback": function (nRow, aData, iDisplayIndex) {//reinitialisierung von funktionen
jQuery('#progressbar_table').hide();
initTableProductClick();
}
})
.columnFilter({ ######################## here are the problems ############################# });

//TableHeader they are invisible /
var oTable2 = jQuery('#tableproduct').dataTable();
for (var i = 0; i < aColumnIndex.length; i++) {
var iCol = aColumnIndex[i];
var bVis = oTable.fnSettings().aoColumns[iCol].bVisible;
oTable2.fnSetColumnVis(iCol, bVis ? false : true);
}


}
}
}
[/code]

Dosent understand what's wrong... please help me ...!

Tank you Tank you ...

best regards Alexander
This discussion has been closed.