Tabulator: Grouping Headers Coloring based on values

Created on 15 Nov 2017  路  2Comments  路  Source: olifolkerd/tabulator

Is there a way to color the grouping headers based on certain values? In my case I want to color them based on how many items are in each group.
I'm sorry if this is answered.

tabulator

Question - Ask On Stack Overflow

All 2 comments

I have not tested this, but can this work out for you?
There might be some errors in code, but it gives you the idea

 groupHeader: function (value, count, data) {
                        //value - the value all members of this group share
                        //count - the number of rows in this group
                        //data - an array of all the row data objects in this group
                        var str = "";

                        var the_header = "";
                        if (count < 10)
                        {
                            the_header = "<span style='color:#d00>"  + value + "</span>"
                        }
                        else
                        {
                            the_header = "<span style='color:#fff>" + value + "</span>"
                        }
                        return the_header;
                    },

That is it. I didn't realize that the code goes in the constructor for the table. Thank You

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sean-magin picture sean-magin  路  19Comments

chdh picture chdh  路  19Comments

daveb49 picture daveb49  路  23Comments

dannykhoo picture dannykhoo  路  17Comments

olifolkerd picture olifolkerd  路  23Comments