-
19 Dec 2012 11:25 AM #1
[2.1] List's refresh() method does not re-render the itemTpl
[2.1] List's refresh() method does not re-render the itemTpl
REQUIRED INFORMATION
Touch version tested:- Sencha Touch 2.1.0
- Safari 5.1.2
- Chrome 23.0.1271.97
- 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.
- create a list with an initial template
- set a new template using setItemTpl()
- call refresh() on the list
- The new template should take effect.
- The old template continued to show up for the list.
HELPFUL INFORMATIONCode: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(); } } ] } ] });
Operating System:- Windows Server 2003
- Windows 7
-
19 Dec 2012 1:59 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
This was fixed for 2.1.1 (will be coming out in new couple weeks)
http://www.sencha.com/forum/showthread.php?248221Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
16 Jan 2013 3:33 PM #3
temp solution
temp solution
Hi,
I am having the same exact problem and I have to go live by the end of Jen.
Is there a temporary solution?
When ST2.1.1 is going to be released otherwise?
-
17 Jan 2013 11:02 AM #4
Alexfluger posted a fix on http://www.sencha.com/forum/showthre...t-(v2.1)/page2
but I haven't tried it personally.
I haven't heard any updates on the 2.1.1 release date. It would be nice to get some news about it.
-
17 Jan 2013 6:21 PM #5
If the template isn't dynamic, put all your templates in a single template toggled on and off by a class.
itemTpl: new Ext.XTemplate("<div class='temp1'>...</div><div class='temp2'...")
etc.
This issue duplicates another issue.


Reply With Quote