CellTable - how to put HTML into a column

664 views
Skip to first unread message

Magnus

unread,
Aug 21, 2012, 3:17:54 AM8/21/12
to google-we...@googlegroups.com
Hello,

I would like to put raw HTML code into a single column of a CellTable.

What is the easiest way to do this?

Thank you
Magnus

Jens

unread,
Aug 21, 2012, 3:26:40 AM8/21/12
to google-we...@googlegroups.com
Thats what SafeHtmlCell is for.

-- J.

Magnus

unread,
Aug 21, 2012, 3:33:38 AM8/21/12
to google-we...@googlegroups.com


Am Dienstag, 21. August 2012 09:26:40 UTC+2 schrieb Jens:
Thats what SafeHtmlCell is for.

 Thanks, but how does this work, i. e. how do I have to modify my code?

  TextColumn<Car> col_Color = new TextColumn<Car>()
  {
   @Override
   public String getValue(Car obj)
   {
    String t = "<font color='#FF0000'>Test</font>";
    return (t);
   }
  };

Jens

unread,
Aug 21, 2012, 3:43:59 AM8/21/12
to google-we...@googlegroups.com
Column<Car, SafeHtml> carCol = new Column<Car, SafeHtml>(new SafeHtmlCell()) {
  
  public SafeHtml getValue(Car car) {
    //return your SafeHtml. Use SafeHtmlTemplates/SafeHtmlUtils to build your SafeHtml.
  }

}

Magnus

unread,
Aug 21, 2012, 3:52:51 AM8/21/12
to google-we...@googlegroups.com
Thanks, this works fine!

Magnus
Reply all
Reply to author
Forward
0 new messages