background color according value with the row grouping plugin
background color according value with the row grouping plugin
avb
Posts: 5Questions: 2Answers: 0
Hello,
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 category ( test, test1, test2 )
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 "test2" is deteted, i would like to add a background color on it.
Have you got an idea?
thank you
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 ( row, data, dataIndex ) {
if ( data[3] == "test" ) {
$(row).addClass('red');}
if ( data[3] == "Test1" ) {
$(row).addClass('yellow');}
if ( data[3] == "Test2" ) {
$(row).addClass('grey');}
This discussion has been closed.
Answers
no one ?