1. #1
    Ext User
    Join Date
    Aug 2008
    Posts
    1
    Vote Rating
    0
    elpaw is on a distinguished road

      0  

    Default Synchronous request and config

    Synchronous request and config


    Hi All,
    I extend Ext.Panel to myPanel and use like this:
    Code:
                var objV = new Ext.Viewport({
                    items: [{
                        xtype: 'myPanel',
                        params1: 1,
                        params2: 2
                    }]
                });
    I would like to read additional parameters from database using synchronous ajax request (in myPanel) and then use returned values as config togather with params1 and params2.
    How is the easiest way to do this?

  2. #2
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,963
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    Quote Originally Posted by elpaw View Post
    Hi All,
    I extend Ext.Panel to myPanel and use like this:
    I would like to read additional parameters from database using synchronous ajax request (in myPanel) and then use returned values as config togather with params1 and params2.
    How is the easiest way to do this?
    The only way to do that currently (especially in a Viewport) is to use the ext-basex/JIT extensions (see my sig below), and:

    Code:
                var objV = new Ext.Viewport({
                    require : [{method:'DOM',debug:true, params: {arg1:1, arg2:2}}, 'classes/myPanel.js'],
                    items: [{
                        xtype: 'myPanel',
                        .....
                    }]
                });
    Note: The method: DOM, debug:true config permits debugging during development.

    or you could manage it another way (asynchronously) by module (source-file) name:

    Code:
    $JIT.setMethod('DOM');
    Ext.onReady(function(){
       $JIT({debug:true, params: {arg1:1, arg2:2}}, 'classes/myPanel.js', 'classes/myGridCls.js);
    
       $JIT.onAvailable(['myPanel','myGridCls'], function(ok){
    
        if(!ok)throw 'we timed out';
    
        var objV = new Ext.Viewport({
                    items: [{
                        xtype: 'myPanel',
                        .....
                    }]
                });
      });
    });
    And, the next version (in trunk) supports by ClassName:

    Code:
     $JIT.onClassAvailable(['Ext.ux.myPanel','Ext.ux.myGridCls'], function(ok){
    
        if(!ok)throw 'we timed out';
    
        var objV = new Ext.Viewport({
                    items: [new Ext.ux.myPanel({region: 'center'}),
                              new Ext.ux.myGridCls({region: 'south'})
                             ],
                    .....
                 });
      });
    });
    Ah, the shameful plugs
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


Thread Participants: 1

Tags for this Thread