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

aballeras01 picture aballeras01  路  3Comments

sphynx79 picture sphynx79  路  3Comments

jiaqianliCn picture jiaqianliCn  路  3Comments

KES777 picture KES777  路  3Comments

cemmons picture cemmons  路  3Comments