You might want to try <ui:safehtml> instead of <ui:text>. On Sunday, September 2, 2012 3:29:40 PM UTC+2, 退5的工科苹岷 wrote: > > Dear All > > I have a database table with a column of HTML contents which will come > from a RichTextArea. Now, I want to display them with additional > information in a CellList. As a sample, although it is too much complex > for the CellList and its AbstractCell, let's regard it as a Q&A web site > like stackoverflow.com. A question and all its replys are writen in HTML > format (end-users key in RichTextArea, and save it in database). I want to > show the question and all its replys with HTML format by CellList. > > > I followed "Rendering HTML for Cells" ( > https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinder#Rendering_HTML_for_Cells). > > But <ui:text> displays HTML strings as plain text in label, all HTML tags > are directly displayed as characters. Means, I expect "*Title*" will be > show to end-user, but end-user will see "<b>Title</b>". > > I tried several way but no one works: > > - Seems template variable "{var}" with <ui:with field='var' > type="Var"/> only will be calculated in tags, and don't support > javascript context. So if {var} or ="{var}" is out of any <tag>, > end-user will see these characters directly, not the calculation result. > Also, <input type="button" onclick="alert('{var}');"> will give you a > black error screen directly. > - Seems triditional uiBinder way: <div ui:field="divA"/> and @UiField > DivElement divA; doesn't work. You can't change it by > divA.setInnerHTML(user.getBody()); in AbstractCell's render(). > - I followed the "Getting rendered elements" to define interface > MyUiRenderer extends UiRenderer<String> {SpanElement getNameSpan(Element > parent);} but I can't get parent element if I just want to load it in > the beginning instead of "click"ing it after every HTML tag > and template variable is loaded and calculated. > - Finally, I defined <div id="{obj.getId}"/> in ui.xml and for (obj > o:oList){DOM.getElementById(o.getId()).setInnerHTML(o.getBody());} . > It doesn't work either. I regard it as a bug. I don't know how to report > it. > > So, Anyone can tell me How to display HTML content in CellList by UiRender > if you know it. I think it should be very simple, I just didn't get the > correct way. Thanks a lot !!! > > -- > Gong Min > [email protected] <javascript:> > >
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/rk_Xa4C53ZUJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
