Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    3
    Vote Rating
    0
    JohnZhou is on a distinguished road

      0  

    Default XTemplate nested loop set wrong parent node

    XTemplate nested loop set wrong parent node


    I use this template
    Code:
    var tpl1 = new Ext.XTemplate(
            '<tpl for="values.a">',
                '<tpl exec="values.parent = parent;"></tpl>',
                '<tpl exec="values.xindex = xindex;"></tpl>',
                '<tpl for="values.b">',
                    '<tpl exec="values.parent = parent;"></tpl>',
                    '<tpl exec="values.xindex = xindex;"></tpl>',
                    '<tpl for="values.c">',
                        '<tpl exec="values.parent = parent;"></tpl>',
                        '<tpl exec="values.xindex = xindex;"></tpl>',
                        '<tpl for="values.d">',
                            '<tpl exec="values.parent = parent;"></tpl>',
                            '<tpl exec="values.xindex = xindex;"></tpl>',
                            '<tpl for="values.e">',
                                '<tpl exec="values.parent = parent;"></tpl>',
                                '<tpl exec="values.xindex = xindex;"></tpl>',
                                '<tpl for="values.f">',
                                    '<tpl exec="values.parent = parent;"></tpl>',    
                                    '<tpl exec="values.xindex = xindex;"></tpl>',
                                    
                                    '</tpl>',
                            '</tpl>',
                        '</tpl>',
                    '</tpl>',
                '</tpl>',
            '</tpl>'
    );
    and filled data
    Code:
    var data1 = {
            a :[{
                b : [{
                    c : [{
                        d : {
                            e :[{
                                 f :[{
                                     test : 'A'
                                },{
                                     test : 'B'                            
                                } ]                   
                            },{
                                 f :[{
                                     test : 'A'
                                },{
                                     test : 'B'                            
                                } ]                   
                            }]
                        }
                    },{
                        d : {
                            e :[{
                                 f :[{
                                     test : 'A'
                                },{
                                     test : 'B'                            
                                } ]                   
                            },{
                                 f :[{
                                     test : 'A'
                                },{
                                     test : 'B'                            
                                } ]                   
                            }]
                        }
                    }]
                },{
                    c : [{
                        d : {
                            e :[{
                                 f :[{
                                     test : 'A'
                                },{
                                     test : 'B'                            
                                } ]                   
                            },{
                                 f :[{
                                     test : 'A'
                                },{
                                     test : 'B'                            
                                } ]                   
                            }]
                        }
                    },{
                        d : {
                            e :[{
                                 f :[{
                                     test : 'A'
                                },{
                                     test : 'B'                            
                                } ]                   
                            },{
                                 f :[{
                                     test : 'A'
                                },{
                                     test : 'B'                            
                                } ]                   
                            }]
                        }
                    }]
                }]
            }]
        };
    tpl1.overwrite(Ext.getBody(), data1);
    Then I find the b[1].parent is array but b[0].parent is object
    Post-Advice - Google Chrome_2013-01-24_16-05-29.png

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,620
    Vote Rating
    817
    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


    What Ext JS 4.x.x version?
    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
    Jan 2013
    Posts
    3
    Vote Rating
    0
    JohnZhou is on a distinguished road

      0  

    Default


    4.1.0
    Quote Originally Posted by mitchellsimoens View Post
    What Ext JS 4.x.x version?

Thread Participants: 1

Tags for this Thread