GroupTable Stylename

A simple question: can I change programmatically the style of a single cell in the grouped row? In a group table I set for example the cell background to RED when a field is > 0. I want that also the same column of the grouped row has the red background.

My code is as follows:

public void onInit(InitEvent event) {
   myTable.setStyleProvider(new GroupTable.GroupStyleProvider<MyEntity>() {
                                         
                                         public String getStyleName(MyEntity entity, @Nullable String property) {
                                            if (property != null && property.equals("fieldTest")) {
                                                if (entity != null && entity.getFieldTest() != null && entity.getFieldTest() > 0) {
                                                    return "red";
                                                }
                                                else
                                                {
                                                    return null;
                                                }
                                            }
                                            else
                                            {
                                                return  null;
                                            }
                                         }

                                         public String getStyleName(GroupInfo info) {
                                             return null;
                                         }
                                     }
    );

Reading online some examples I find the way to colour all the grouped row. I know that I can “work” in the getStyleName(GroupInfo info) method but I don’t know how to change only a cell of the row.

Thanks in advance.

Hello,

the group row has only one cell. You can check it in the DevTools of your browser.

The example of styling GroupTable rows you can find in the sampler demo.