add style to group row names datatable
add style to group row names datatable
avb
Posts: 5Questions: 2Answers: 0
I use the row grouping datatable plugin. On the following script i have a background color for each new rows of the group according to the name of the group .
That s not what i want, I would like to add a background color directly on the row of the group. ex : when the group name "Cardio-training" is deteted, i would like to add a background color on it. ( see on the attached image )
Have you got an idea? thank you
here is the javascript/jquery script :
api.column(3, {page:'current'} ).data().each( function ( group, i ) {
if ( last !== group ) {
$(rows).eq( i ).before(
'<tr><td class="espace" colspan="5"></td></tr>',
'<tr class="group"><td colspan="5">'+group+'</td></tr>'
);
last = group;
}
} );
"createdRow" : function (tr, tdsContent) {
if (tdsContent[3] === 'Cardio-training' {
tr.style.backgroundColor='red'; }}
This discussion has been closed.