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
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    847
    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


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

  4. #4
    Sencha Premium Member
    Join Date
    Mar 2010
    Posts
    10
    Vote Rating
    0
    ahameed is on a distinguished road

      0  

    Default


    My panel first time loads fine but after the interval mentioned in startAutoRefresh, it disappears and never comes back unless I refresh the page from start. Here is the code snippet:
    Loader for panel:
    Code:
    loader: {
                   url: 'myPage.jsp',
                   renderer: 'html',
                   scripts: true,
                   autoLoad: true
                   },
    The listener:

    Code:
    afterrender: function(panel) {
       panel.getLoader().startAutoRefresh(5000);
    }

Thread Participants: 2

Tags for this Thread