1. #1
    Sencha User
    Join Date
    Mar 2008
    Posts
    58
    Vote Rating
    0
    johnstontrav is on a distinguished road

      0  

    Question Help! - How do you use arguments?

    Help! - How do you use arguments?


    Hi,

    Can someone give me a real basic example on how to use the arguments var?

    I know this is incorrect, but am i on the right track?

    PHP Code:
    Ext.BLANK_IMAGE_URL './ext/resources/images/default/s.gif';
    Ext.ns('Application');

    Application.PersonnelGrid Ext.extend(Ext.grid.GridPanel, {
         
    border:false
        
    ,initComponent:function() {
            
            
    Ext.apply(this, {
               
    storethis.store
              
    ,cm: new Ext.grid.ColumnModel([...]);
              ,
    viewConfig:{forceFit:false}
            });
     
            
    Application.PersonnelGrid.superclass.initComponent.apply(thisarguments);
        } 
     
        ,
    onRender:function() {
            
    this.store.load();
            
            var 
    color arguments[0]; <-- i need help here?
     
            
    Application.PersonnelGrid.superclass.onRender.apply(thisarguments);
        } 
    });
     
    Ext.reg('personnelgrid'Application.PersonnelGrid);
     

    Ext.onReady(function() {
     
        var 
    pg = new Application.PersonnelGrid({color'red'});
        
        var 
    win = new Ext.Window({
             
    title:'Personnel'
            
    ,width:900
            
    ,height:300
            
    ,items:{xtype:'personnelgrid'}
        });
        
    win.show();
     
    }); 
    Any help would be great!

  2. #2
    Ext JS Premium Member dj's Avatar
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    576
    Vote Rating
    2
    dj has a spectacular aura about dj has a spectacular aura about dj has a spectacular aura about

      0  

    Default


    arguments is a Array-like variable that is set automatically by the JavaScript interpreter to the arguments passed to a function. An example:
    Code:
    function test(a,b){
      console.log(arguments);
    }
    test(1,2); //outputs [1,2]
    test(1,2,3); // outputs [1,2,3]
    it is useful to implement function that can handle an arbitrary amount of parameters.


    You don't have a problem with arguments, tho...
    Your code should look like this
    Code:
    Ext.BLANK_IMAGE_URL = './ext/resources/images/default/s.gif';
    Ext.ns('Application');
    
    Application.PersonnelGrid = Ext.extend(Ext.grid.GridPanel, {
         border:false
        ,initComponent:function() {
            
            Ext.apply(this, {
               store: this.store
              ,cm: new Ext.grid.ColumnModel([...]);
              ,viewConfig:{forceFit:false}
            });
     
            Application.PersonnelGrid.superclass.initComponent.apply(this, arguments);
        } 
     
        ,onRender:function() {
            this.store.load();
            
            var color = this.color;
     
            Application.PersonnelGrid.superclass.onRender.apply(this, arguments);
        } 
    });
     
    Ext.reg('personnelgrid', Application.PersonnelGrid);
     
    
    Ext.onReady(function() {
     
        var pg = new Application.PersonnelGrid({color: 'red'});
        
        var win = new Ext.Window({
             title:'Personnel'
            ,width:900
            ,height:300
            ,items:[pg]
        });
        win.show();
     
    });
    or use xtypes:
    Code:
    Ext.onReady(function() {
     
        var pg = new Application.PersonnelGrid({color: 'red'});
        
        var win = new Ext.Window({
             title:'Personnel'
            ,width:900
            ,height:300
            ,items:[{
               xtype:'personnelgrid',
               color:'red'
            }]
        });
        win.show();
     
    });
    Daniel Jagszent
    dɐɳiel@ʝɐgszeɳt.de <- convert to plain ASCII to get my email address

  3. #3
    Sencha User
    Join Date
    Mar 2008
    Posts
    58
    Vote Rating
    0
    johnstontrav is on a distinguished road

      0  

    Default


    Thanks dj! That was perfect!!!

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar