REQUIRED INFORMATION
Touch version tested:
  • Sencha Touch 2.1.0
Browser versions tested against:
  • Safari 5.1.2
  • Chrome 23.0.1271.97
Description:
  • When you use setItemTpl to change the template for a list, it will continue to show the old template even after calling refresh() on the list. The documentation for refresh() states that it "Refreshes the view by reloading the data from the store and re-rendering the template" but it doesn't seem to work that way. It seemed to work in Sencha Touch 2.0.1 and 1.1, but no longer works.
Steps to reproduce the problem:
  • create a list with an initial template
  • set a new template using setItemTpl()
  • call refresh() on the list
The result that was expected:
  • The new template should take effect.
The result that occurs instead:
  • The old template continued to show up for the list.
Test Case:
Code:
        Ext.Viewport.add(
        {
            id: 'MainList',
            xtype: 'list',
            itemTpl: '{name}',
            store:
            {
                fields: ['name', 'position'],
                data: [
                        { name: 'Bob', position: 'Goalie' },
                        { name: 'Tom', position: 'Left Wing' },
                        { name: 'Ralph', position: 'Defense' }
                    ]
            },
            items:
            [
                {
                    docked: 'top',
                    xtype: 'toolbar',
                    items:
                    [
                        {
                            xtype: 'button',
                            text: 'Update Template',
                            ui: 'accept',
                            handler: function ()
                            {
                                this.up('list').setItemTpl('{position}');
                                this.up('list').refresh();
                            }
                        }
                    ]
                }
            ]
        });
HELPFUL INFORMATION
Operating System:
  • Windows Server 2003
  • Windows 7