1. #1
    Sencha User
    Join Date
    Feb 2011
    Location
    Düsseldorf, Germany
    Posts
    567
    Vote Rating
    31
    Kurt001 has a spectacular aura about Kurt001 has a spectacular aura about

      0  

    Default [SOLVED] Understanding Namespace and Ext.regApplication

    [SOLVED] Understanding Namespace and Ext.regApplication


    Hi there,

    I am having two *.js files.
    1) index.js, which holds
    PHP Code:
    Ext.regApplication({
        
    name'dropMe',
        
    launch: function() {

            var 
    board = new Ext.Panel
                
    ({
                    
    layout"card",
                    
    items: [],
                    
    dockedItems: [],
                });
    var 
    myBoardFiller = new fillBoard();
            
    myBoardFiller.doTheFill();

    2) helper.js which holds:

    PHP Code:
    function fillBoard(){
        
    this.doTheFill = function(){
            var 
    myText = new Ext.form.Text();
            
    myText = {
                
    name'textName',
                
    label:'textLabel'
            
    }
            
    dropMe.board.add(myText);
        }

    But it reports back that dropMe.board is not an object.
    Whats wrong?

    Best TD

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Location
    Glasgow, Scotland
    Posts
    281
    Vote Rating
    1
    Stoot98 will become famous soon enough

      0  

    Default


    Instead of defining 'board' as a local variable you will need to define it as a property of the dropMe namespace object. So instead of "var board = ..." change it to "dropMe.board = ..."

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Location
    Düsseldorf, Germany
    Posts
    567
    Vote Rating
    31
    Kurt001 has a spectacular aura about Kurt001 has a spectacular aura about

      0  

    Default Thanks works, but update does not work

    Thanks works, but update does not work


    Hi,
    now I changed it like this:

    PHP Code:
    function fillBoard(){
        
    this.doTheFill = function(){
            var 
    myText = new Ext.form.Text();
            
    myText = {
                
    style"background-color:green;",
                
    name'textName',
                
    label:'textLabel'
            
    }
            
    dropMe.board.add(myText);
            
    dropMe.board.update();
        }
    }


    Ext.regApplication({
        
    name'dropMe',
        
    launch: function() {
            
            
    dropMe.board = new Ext.Panel({
                
    fullscreentrue,
                
    style"background-color:#dadee2;",
                
    layout"card"
            
    });
            
            var 
    myBoardFiller = new fillBoard();
            
    myBoardFiller.doTheFill();
        }
    }) 
    But update does not work. If I change the size of Safari, it shows up.
    What is wrong here?

    Best TD

  4. #4
    Sencha User
    Join Date
    Feb 2009
    Location
    Glasgow, Scotland
    Posts
    281
    Vote Rating
    1
    Stoot98 will become famous soon enough

      0  

    Default


    Replace "dropMe.board.update();" with "dropMe.board.doLayout()"

  5. #5
    Sencha User
    Join Date
    Feb 2011
    Location
    Düsseldorf, Germany
    Posts
    567
    Vote Rating
    31
    Kurt001 has a spectacular aura about Kurt001 has a spectacular aura about

      0  

    Default thanks again

    thanks again


    Great, thanks.

Thread Participants: 1