How to add icon to grid column?

Hi!
I want to add icon my grid column. the type of this column is boolean. I need to add icon if it is true, else i want to leave empty.
how can i do it?
( I know, my english is a little bad :))

(i am using vaadin 8)

The simplest way is to get html definition of the e.g. icon from FontAwesome, there is API for that, and use HTMLRenderer. Check e.g. this video at 15 mins.

https://www.youtube.com/watch?v=BEnm9vG6eow

Or as simplified code example:

Grid.Column truth = grid.getColumn("truth");
truth.setRenderer(new HtmlRenderer(), new StringToBooleanConverter() {
  @Override
  protected String getTrueString() {
    return FontAwesome.CHECK_CIRCLE_O.getHtml();
  }

  @Override
  protected String getFalseString() {
    return FontAwesome.CIRCLE_O.getHtml();
  }
});

thank you for your reply, but i am using vaadin 8. i am sorry because i forgot to write it.

Hi,

I did this in a treegrid (I think you can do in same way in a grid) by adding the fontawesome icon in your css and using the setstylegenerator to attach the css to your grid. For a treegrid, in case you want to add the icon the hierarchy column, you have to add it to the v-treegrid-cell-content:before class.

For a grid you need just to find the right css class by inspecting the html code of your UI.

Hope this will help you.