-
29 Jan 2012 4:15 PM #1
Panel with autoloader and autorefresh
Panel with autoloader and autorefresh
I am trying to create a panel with a loader and an auto refresh in fixed intervals after rendering. On auto refresh, the components are duplicated rather than being overwritten. I tried to add removeAll() and doLayout() on the panel before the autorefresh line which didn't help.
Ext JS code
Code:var myPanel = Ext.create('Ext.panel.Panel', { title: 'Hello', region: 'center', loader: { url: 'progress.php', renderer: 'component', autoLoad: true }, defaults: { border: false, layout: 'fit' }, listeners: { afterrender: function(c) { c.getLoader().startAutoRefresh(5000); } } });
Sample component from the loader URL.
Thanks for looking.Code:{ xtype: 'textfield', name: 'email', fieldLabel: 'Email Address', vtype: 'email' }
-
30 Jan 2012 7:20 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
You said you have tried removing all? Like this:
Code:Ext.create('Ext.panel.Panel', { title: 'Hello', renderTo : document.body, loader: { url: 'data.json', renderer: 'component', autoLoad: true, listeners : { beforeload : function(loader) { var panel = loader.target; panel.removeAll(); } } }, defaults: { border: false, layout: 'fit' }, listeners: { afterrender: function(c) { c.getLoader().startAutoRefresh(5000); } } });Mitchell 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.
-
30 Jan 2012 8:02 AM #3
Thanks mitchellsimoens
Have visited this thread to update about the same thing. Adding beforeload event on the loader worked fine. A suggestion from you means its not a hack.


Reply With Quote