开发者

Cell colors in a GWT CellTable

I'm using a CellTable and would like to programati开发者_开发问答cally change the background color of certain cells in some situations. I tried it with an Custom Cell as described in the documentation and changed the background color with

sb.appendHtmlConstant ("<div style=\"background-color:blue;\">");
sb.append (safeValue);
sb.appendHtmlConstant ("</div>");

This basically works, but seems to be quite slow. Is there a better way to do this?


Actually you can Override getCellStyleNames() and return the wanted style for the cell

            TextColumn<Composant> nameColumn= new TextColumn<Composant>() {

                @Override
               public String getCellStyleNames(Context context, Composant  object) {
                     return "styleName";
                 }  

                @Override
                public String  getValue(Composant object) {                                         
                    return object.getName();
                }           

              };
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜