1. #1
    Ext User
    Join Date
    Aug 2009
    Posts
    5
    Vote Rating
    0
    febus is on a distinguished road

      0  

    Default Ext.get call

    Ext.get call


    What is the difference if I call Ext.get method from a javascript function and from anonymous function?
    In case of anonymous function in the example below, Ext.get returns the value and myDiv1 is not null. In case of a function OnReadyHandler Ext.get returns null.
    Can you explain me why Ext.get is not working in OnReadyHandler?

    HTML Code:
    <html>
    <head>
        <title>Getting started</title>
    
    
        <link rel="stylesheet" type="text/css" 
            href="lib/extjs/resources/css/ext-all.css" />
        <script src="lib/extjs/adapter/ext/ext-base.js" ></script>
        <script src="lib/extjs/ext-all-debug.js" ></script>
        <script>
            // Function doesn't work! => myDiv1 is null!
            //function OnReadyHandler()
            //{
            //    var myDiv1 = Ext.get('div1'); // <<< NOT WORKING!
            //    myDiv1.setHeight(200);
            //}
            //Ext.onReady(OnReadyHandler());
            
            Ext.onReady(function(){
                var myDiv1 = Ext.get('div1'); //OK, myDiv1 has a value
                myDiv1.setHeight(200);
            });
            
        </script>
    </head>
    <body>
        <style type="text/css">
            .myDiv {
                border : 1px solid #AAAAAA;
                width : 200px;
                height : 35px;
                cursor : pointer;
                padding : 2px 2px 2px 2px;
                margin : 2px 2px 2px 2px;
            }
        </style>
        <div id='div1' class='myDiv'> </div>
    </body>
    </html>

  2. #2
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    673
    Vote Rating
    20
    carol.ext will become famous soon enough carol.ext will become famous soon enough

      0  

    Default


    Remove the parens '()', you are calling OnReadyHandler and passing the result to Ext.onReady().

    This passes result of OnReadyHandler function call :

    Code:
    Ext.onReady(OnReadyHandler());

    This passes reference to function :

    Code:
    Ext.onReady(OnReadyHandler);

  3. #3
    Ext User
    Join Date
    Aug 2009
    Posts
    5
    Vote Rating
    0
    febus is on a distinguished road

      0  

    Default



Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi