1. #1
    Sencha User
    Join Date
    Nov 2008
    Posts
    24
    Vote Rating
    0
    manoj123 is on a distinguished road

      0  

    Default 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.

    Code:
            
    {
          xtype: 'textfield',        name: 'email',
            fieldLabel: 'Email Address',
            vtype: 'email'  
    }
    Thanks for looking.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    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.

  3. #3
    Sencha User
    Join Date
    Nov 2008
    Posts
    24
    Vote Rating
    0
    manoj123 is on a distinguished road

      0  

    Default


    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.

Tags for this Thread