Tabulator: Custom Formatter - Background Color Not Set in IE11

Created on 16 Dec 2019  路  4Comments  路  Source: olifolkerd/tabulator

Describe the bug
Using a custom formatter, setting the cell style/background color does not work in IE 11. It does work in Chrome.

Tabulator Info

  • 4.5.2

Working Example
https://jsbin.com/tesuteveye/1/edit?html,js,output

To Reproduce
Create a column with a custom formatter and set the cell style/background color.
Background does not change

Expected behavior
I expect the cell background color to be set.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser IE 11.64.16299.0
   {title: "Total Conformance Rating", field: "conformrating",  formatter: function (cell, 
             formatterParams) 

              {

                        //cell - the cell component
                        //formatterParams - parameters set for the column

                        var value = cell.getValue();

                        if (value === "Poor") {
                            cell.getElement().style = "background-color: #FF9999";
                        }
                        else if (value === "Fair") {
                            cell.getElement().style = "background-color: #FFFF99";
                        }
                        else if (value === "Good") {
                            cell.getElement().style = "background-color: #99ff99";
                        }

                        return value;
                    },
                }
Invalid Not Tabulator Question - Ask On Stack Overflow

Most helpful comment

No problem Oli. You're doing a fantastic job! Happy holidays.

All 4 comments

Hey @rs199483

That is because you are not setting the style correctly, you should not be setting the style property to a string, it should be treated as an object:

    cell.getElement().style.backgroundColor = "#FF9999";

I hope that helps,

Cheers

Oli :)

Oli,

Just to clarify, it should be style.backgroundColor. Yes, this works now in both Chrome and IE11. Thanks!

cell.getElement().style.backgroundColor = "#FF9999";

Thanks, i have a dodgey full stop key on my keyboard lol

No problem Oli. You're doing a fantastic job! Happy holidays.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sphynx79 picture sphynx79  路  3Comments

andreivanea picture andreivanea  路  3Comments

yaxino picture yaxino  路  3Comments

c3pos-brother picture c3pos-brother  路  3Comments

KES777 picture KES777  路  3Comments