Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-1365 in a recent build.
  1. #1
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    529
    Vote Rating
    17
    estesbubba will become famous soon enough

      0  

    Default component with tpl and setData()

    component with tpl and setData()


    So the template renders correctly and the first setData() works as expected, but each additional call to setData() doesn't work. Keep clicking the button to see and look at the console to see that the data is actually changed.

    Code:
    Ext.application({
        name: 'App',
        
        total: 0,
        accountData: {
            name: 'Mike',
            inserted: 0
        },
        accountTpl: [
            '<div class="c-account-info">',
                '<div class="c-name">{name}</div>',
                '<div class="c-inserted-hdr">Cash Inserted</div>',
                '<div class="c-inserted">$ {inserted}</div>',
            '</div>'
        ],
    
    
        
        launch: function(options) {
            Ext.Viewport.setActiveItem({
                xtype: 'container',
                layout: {
                    type : 'vbox',
                    align: 'middle'
                },
    
    
                items: [{
                    xtype: 'component',
                    itemId: 'accountData',
                    tpl: this.accountTpl,
                    data: this.accountData
                }, {
                    xtype: 'button',
                    text: 'Click to add $5',
                    handler: function() {
                        var data = this.accountData;
    
    
                        this.total += 5;
                        data.inserted = this.total;
                        console.log(Ext.encode(data));
                        Ext.Viewport.down('#accountData').setData(data);
                    },
                    scope: this
                        
                }]
            })
        }
    });

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


    It looks like the object this.accountData and the object _data on your component are being shared meaning the data was not cloned. It works as expected when you do:

    Code:
    Ext.application({
        name: 'App',
    
        total: 0,
        accountData: {
            name: 'Mike',
            inserted: 0
        },
        accountTpl: [
            '<div class="c-account-info">',
                '<div class="c-name">{name}</div>',
                '<div class="c-inserted-hdr">Cash Inserted</div>',
                '<div class="c-inserted">$ {inserted}</div>',
            '</div>'
        ],
    
    
    
        launch: function(options) {
            Ext.Viewport.setActiveItem({
                xtype: 'container',
                layout: {
                    type : 'vbox',
                    align: 'middle'
                },
    
    
                items: [{
                    xtype: 'component',
                    itemId: 'accountData',
                    tpl: this.accountTpl,
                    data: this.accountData
                }, {
                    xtype: 'button',
                    text: 'Click to add $5',
                    handler: function() {
                        var data = Ext.apply({}, this.accountData);
    
    
                        this.total += 5;
                        data.inserted = this.total;
                        console.log(Ext.encode(data));
    
                        var cmp = Ext.Viewport.down('#accountData');
                        cmp.setData(data);
                    },
                    scope: this
    
                }]
            })
        }
    });
    I will still open this bug as we need to clone the object ourselves so this doesn't happen.
    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
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    529
    Vote Rating
    17
    estesbubba will become famous soon enough

      0  

    Default


    Thanks for the workaround. Put it in and it works now.

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