excelHtml5 Format column A if condition in column B is met
excelHtml5 Format column A if condition in column B is met

I am pretty new to Datatables. I now want to format the first Column of my exported Excel sheet, if another column B of that row is <0. Column B is a percentage Value. How can I achieve that?
$('row c[r^="B"]', sheet).attr( 's', 60); // Format column B to percentage
$('row c[r^="B"]', sheet).each( function () {
if (parseFloat($(this).text()) < 0) {
$(this).('row c[r^="A"]', sheet).attr( 's', '22' ); // this does not work
}
});
This discussion has been closed.
Answers
This example shows how to modify and test the cells. That should get you going.
Colin
Thank you Colin. Very interesting, but I think my problem is that I have a column with Percentage. I tried to set the style to a colour before, but then the Percentage changed from 15% to 0.15% so I had to use s60 to have the right percentage. I then tried to assign a second style, but I found out that this is not possible, so I thought to have Column B the Percentage style assigned s60 and column A gets a background colour of red. But I now just don't know how I can say Loop through Column B and if B is below 0% meaning its -x% then go to Column A and make background s35. I hope this makes sense even if I would prefer to have Column B defined as Percentage and Font colour red if the value is -x%, but I guess this does not work.
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin