Hybrid View

  1. #1
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default DomHelper.Template.compile

    DomHelper.Template.compile


    Instead of

    Code:
        compile : function(){
            var html = this.html;
            var re = /\{(\w+)\}/g;
            var body = [];
            body.push("this.compiled = function(values){ return ");
            var result;
            var lastMatchEnd = 0;
            while ((result = re.exec(html)) != null){
                body.push("'", html.substring(lastMatchEnd, result.index), "' + ");
                body.push("values[", html.substring(result.index+1,re.lastIndex-1), "] + ");
                lastMatchEnd = re.lastIndex;
            }
            body.push("'", html.substr(lastMatchEnd), "';};");
            eval(body.join(''));
    It should be

    Code:
        compile : function(){
            var html = this.html;
            var re = /\{(\w+)\}/g;
            var body = [];
            body.push("this.compiled = function(values){ return ");
            var result;
            var lastMatchEnd = 0;
            while ((result = re.exec(html)) != null){
                body.push("'", html.substring(lastMatchEnd, result.index), "' + ");
                body.push("values[\"", html.substring(result.index+1,re.lastIndex-1), "\"] + ");
                lastMatchEnd = re.lastIndex;
            }
            body.push("'", html.substr(lastMatchEnd), "';};");
            eval(body.join(''));
    The strings inside {}s are the property names in the values associative array.

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    It's already been fixed with single quotes. There's a thread about it in the help forum.

Similar Threads

  1. Ext.DomHelper.Template: one template, ten YUI grids
    By moraes in forum Community Discussion
    Replies: 11
    Last Post: 18 Dec 2012, 4:55 AM
  2. DomHelper Template using tables (bug in ff & insert at t
    By aconran in forum Ext 1.x: Help & Discussion
    Replies: 14
    Last Post: 13 Mar 2007, 11:48 AM
  3. Ext.DomHelper.Template or Ext.Template?
    By mystix in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 1 Mar 2007, 3:05 PM
  4. DomHelper.Template and UpdateManager
    By valc in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 4 Jan 2007, 8:44 AM

Thread Participants: 1