1. #1
    Sencha User
    Join Date
    Jul 2008
    Posts
    96
    Vote Rating
    0
    ritcoder is on a distinguished road

      0  

    Question [4.1.0 beta 2] Error in XTemplate output if text contains { and }

    [4.1.0 beta 2] Error in XTemplate output if text contains { and }


    Hi all,
    Ext.XTemplate is giving interesting output when used with text that contains {} Below are the code and responses

    Code:
    Ext.create('Ext.XTemplate','function {name}(){}').apply({name:'ben'})
    output : TypeError: Cannot read property 'type' of undefined

    Code:
    Ext.create('Ext.XTemplate','function {name}()').apply({name:'ben'})
    output: works

    Code:
    Ext.create('Ext.XTemplate','function {name}(){ return 20;}').apply({name:'ben'})
    output: "function ben()"

    Code:
    Ext.create('Ext.XTemplate','function {name}(){{ return 20;}}').apply({name:'ben'})
    "function ben(){}"

    Code:
    Ext.create('Ext.XTemplate','function {name}(){{ return 20;}}').apply({name:'ben'})
    "function ben(){}"

    Code:
    Ext.create('Ext.XTemplate','function {name}(){{}}').apply({name:'ben'})
    TypeError: Cannot read property 'type' of undefined


    1. Is this a bug?
    2. If not, how do you use XTemplate for expand text containing such data?
    3. How do I get around this?

    regards.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,735
    Vote Rating
    756
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    This sounds like why you can't use > in an if... because it means something. You have to use >
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jul 2008
    Posts
    96
    Vote Rating
    0
    ritcoder is on a distinguished road

      0  

    Question


    Not following. There is no > in my code.
    Did you mean } ?

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,735
    Vote Rating
    756
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Was an example that is in the documentation.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Jul 2008
    Posts
    96
    Vote Rating
    0
    ritcoder is on a distinguished road

      0  

    Default


    I just searched the documentation for XTemplate. I could find not such thing. Can you please point me to the section so I can just search for it.

    I have seen the one on >. That is not what I'm using. The issue I'm having has to do with { and }. In .NET, we used {{ and }} for the literal. Tried that, as you can see from the initial code, but it did not work.

  6. #6
    Sencha User
    Join Date
    Jul 2008
    Posts
    96
    Vote Rating
    0
    ritcoder is on a distinguished road

      0  

    Default


    Haven't heard anything else about this.
    Is this an error? Am I doing something wrong?
    I ended up using _.tempate which uses <%= %>. It works but I do prefer the {} syntax used by extjs.

  7. #7
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    796
    Vote Rating
    38
    westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough

      0  

    Default


    Just stumbled upon this... I think what Mitchell is saying is that the curly braces need to be escaped.

    You tried using \u007B and \u007D for { and } respectively?
    Product Architect
    Altus Ltd.

  8. #8
    Sencha User
    Join Date
    Jul 2008
    Posts
    96
    Vote Rating
    0
    ritcoder is on a distinguished road

      0  

    Default


    Well, I tried

    PHP Code:
    Ext.create('Ext.XTemplate','function {name}()\u007B \u007D').apply({name:'ben'}) 
    Got the error:
    PHP Code:
    TypeErrorCannot read property '1' of null 
    I used google chrome. 4.1.0rc1

  9. #9
    Sencha User
    Join Date
    Jul 2007
    Location
    Sydney Australia
    Posts
    7
    Vote Rating
    3
    jamesmoey is on a distinguished road

      1  

    Default


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

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