Results 1 to 2 of 2

Thread: XTemplate question

  1. #1
    Sencha Premium Member
    Join Date
    Nov 2012
    Vote Rating

    Default XTemplate question

    I'm trying to use XTemplates to render something that looks like this:

    The streamItem is the POJO and the comments is the field containing the text. The text can also contain (sometimes, not always) a few links inside the arbitrary comments. I'd like to linkify those so that users can click on them. I'm currently trying with this declared on the Template:
    @FormatterFactories(@FormatterFactory(factory=AutolinkerFactory.class, name="linkUrls"))
    The linker works fine, but what it is being shown is safe html instead of the actual <a> tags and link. It seems like the output of the formatter gets run through safe html after it formats.

    Is there any way to do what I'd like to? Or a better solution?


  2. #2
    Sencha User
    Join Date
    Feb 2009
    Vote Rating


    At present we do not have support for formatters that return SafeHtml objects. It isn't a simple change, so would be something that we would add as part of 3.1 or a later release. While I've considered adding this, I never put much thought into it (as there is a way to implement this sort of feature already, see below). Additionally, this is the first time I've heard the idea mentioned by a GXT user.

    One idea would be to add a method to your POJO that builds up a SafeHtml value. If you used a SafeHtmlBuilder to render the content, this code could be shared between the client and the server - if you used another XTemplate inside there, you'd need to be sure not to call it on the server.

    Sample method (minus actual wiring, since I don't know your pojo or your behavior):
    public SafeHtml renderComments() {
    XTemplate code to get that output:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts