Results 1 to 6 of 6

Thread: Problem with Ext.XTemplate escaping javascript functions

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Sep 2008
    Posts
    23
    Vote Rating
    0
      0  

    Default Problem with Ext.XTemplate escaping javascript functions

    I have a xtpl config that needs to include some custom javascript, so I'm doing something like this:

    Code:
    tpl: {
    '<tpl>my template stuff <script>function test() { // some javascript }</script></tpl>'
    }
    the template loads like this

    Code:
    my template stuff <script>function test()
    even escaping the { like this \{ it doesn't work, does anyone has a clue how to escape { inside XTemplate?

    thanks!

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,389
    Vote Rating
    498
      0  

    Default

    Have a look at the following:
    http://docs.sencha.com/ext-js/4-0/#!/api/Ext.XTemplate

    Functions are supported.

    Regards,
    Scott.

  3. #3
    Sencha User
    Join Date
    Jul 2007
    Location
    Sydney Australia
    Posts
    7
    Vote Rating
    3
      2  

    Default

    Try "{['{']}" and "{['}']}"

  4. #4
    Sencha User
    Join Date
    Sep 2008
    Posts
    23
    Vote Rating
    0
      0  

    Default

    I realized it's nonsense to embed JS in a template since functions are supported and since you can load external JS too, I was just trying to use some custom code for a html5 player and got surprised it just didn't work right away, thanks for the help!

  5. #5
    Ext JS Premium Member devtig's Avatar
    Join Date
    Jan 2010
    Location
    Rotterdam, The Netherlands
    Posts
    419
    Vote Rating
    14
      0  

    Default

    Quote Originally Posted by jamesmoey View Post
    Try "{['{']}" and "{['}']}"
    I can confirm that this works.

    PS: I dont use functions in the template but just curly braces.
    Christiaan Westerbeek @ Devotis
    Contact me for help with Ext JS, Node JS, FireBase, AngularJS and Javascript in general. Email me or find me at AirPair to connect.

  6. #6
    Sencha Premium Member
    Join Date
    Jan 2014
    Posts
    1
    Vote Rating
    0
      0  

    Default

    Try \\{ and \\}

Tags for this Thread

Posting Permissions

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