I made a large table for jquery.datatables which is works great for me.
but i need a class name set to each td element relative to its column.
fo example i want a column (including th and all td's) have a class=volume
.
there is this issues:
i use this code to initialize the class but it is not working.
aoColumnsDefs: [
{ sClass: volume, aTargets: [2] }
]
EDIT:
my table is created and refeshes dynamically. and it is made of a js-array which i prefer not to touch it ie. just to add class names
EDIT:
iuse this code to itialize my table:
$('#dataTable').dataTable({
aaData: dataCnt,
aoColumnsDefs: [
{ sClass: volume, aTargets: [2] }
],
aoColumns: columnsHd,
bStateSave: true,//saving status in coockie
iCookieDuration: 10,//coockie life duration in seconds
sScrollX: 100%,
sScrollY: (winHei-200),
sDom: '<HRCfrl>t<pFi>',
oColVis: {
buttonText: ,
bRestore: true,
sAlign: left
},
aLengthMenu: [[10, 25, 50, -1], [10, 25, 50, All]]
});
i hope it helps
*EIDT: *
columnsHd
is an array which is created dynamicaly from my json headers and now is exactly:
[
{ sTitle: macaddr },
{ sTitle: lat },
{ sTitle: ip },
{ sTitle: clientname },
{ sTitle: relay0mask },
{ sTitle: relay0stat },
{ sTitle: relay1stat },
{ sTitle: clientid },
{ sTitle: bldname },
{ sTitle: uptime },
{ sTitle: current },
{ sTitle: temperature },
{ sTitle: softver },
{ sTitle: volume },
{ sTitle: hardver },
{ sTitle: relay1mask },
{ sTitle: pic },
{ sTitle: comment },
{ sTitle: lon },
{ sTitle: rtt },
{ sTitle: bldaddr },
]