1. #1
    Sencha Premium Member
    Join Date
    Nov 2012
    Posts
    1
    Vote Rating
    0
    mosseri is on a distinguished road

      0  

    Default XTemplate question

    XTemplate question


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

    Code:
    <div>{streamItem.comments:linkUrls}</div>
    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?

    Thanks!

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,634
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    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):
    Code:
    public SafeHtml renderComments() {
     //...
    }
    XTemplate code to get that output:
    Code:
    <div>{streamItem.renderComments}</div>

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar