1. #1
    Sencha Premium Member
    Join Date
    Jul 2009
    Posts
    111
    Vote Rating
    0
    JacobGu is on a distinguished road

      0  

    Default Controller applies control ComponentQuery before UI components created?

    Controller applies control ComponentQuery before UI components created?


    The way I am understanding the Sencha code is that component queries for a Controller's control events are applied when the Controller is initialized, which would seem to happen before the UI components are created. If that's the case, then how would control events ever attach to anything?

    Here is my sample code, whereby the tap event in control never fires. I commented out in the controller launch method an explicit event listener attachment. If you de-comment it, the tap event will fire.

    Code:
    <!DOCTYPE html>
    <html>
        <head>
            <title>Sencha Test</title>
            
            <script type="text/javascript" src="sencha-touch-all-debug.js"></script>
            <link href="sencha-touch.css" rel="stylesheet" type="text/css" />
    
    
    		<script type="text/javascript">
    
    
    			Ext.define('Test.view.LoginForm', {
    			    extend: 'Ext.form.Panel',
    			    alias: 'widget.loginform',
    
    
    			    config: {
    
    
    				    fullscreen: true,
    
    
    					layout: 'vbox',
    					submitOnAction: false,
    					scrollable: false,
    					padding: 18,
    
    
    					items: [{
    						xtype: 'component',
    						cls: 'open-login',
    						style: 'font-size:12px;font-weight:bold',
    						tpl: [
    					    	'<div style="float:left;margin-top:8px;margin-right:10px">Log in using:</div>',
    							'<tpl for="providers">',
    								'<div class="providerlink" style="float:left;margin-left:5px">',
    									'<img class="{.}" src="http://www.fareclock.com/static/site/images/icons/{.}-icon.png" style="width:46px;height:46px">',
    								'</div>',
    							'</tpl>',
    						],
    						data: {
    							providers: ['google', 'yahoo']
    						}
    			        }]
    				} 
    			});
    			
    			Ext.define('Test.controller.Main', {
    			    extend: 'Ext.app.Controller',
    				requires: [
    					'Test.view.LoginForm',
    				],
    				
    				config: {
    
    
    					refs: {
    						
    						openLogin: 'loginform component[cls=open-login]'
    					},
    
    
    			        control: {
    
    
    			        	openLogin: {
    			        		tap: 'doSignInProvider'
    			        	}
    			        }
    				},
    
    
    				doSignInProvider: function(e, t){
    					
    					var target = e.getTarget('div.providerlink img');
    
    
    			        //wasn't tapped on the img
    			        if (!target) {
    			            return;
    			        }
    					
    					var provider = t.className;
    					alert(provider);
    				},
    								
    				launch: function(){
    
    
    					var openLogin = this.getOpenLogin();
    					if(openLogin && openLogin.rendered){
    						//openLogin.element.on('tap', 'doSignInProvider', this);
    					}
    			    }
    			});
    
    
    			Ext.application({
    			    name: 'Test',
    
    
    			    views: ['LoginForm'],
    			    models: [],
    			    stores: [],
    			    controllers: ['Main'],
    			
    				launch: function() {
    
    
    					if(!Ext.os.is.iOS){
    						// probably desktop browser, so simulate iPhone layout
    						Ext.Viewport.setWidth(320);
    						Ext.Viewport.setHeight(480);
    						Ext.Viewport.setMargin(50); // leave a little space in dom around the viewport
    					}
    					
    					Ext.create('Test.view.LoginForm');
    				}
    			});
    			
    		</script>
        </head>
    	<body>
    	</body>
    </html>

  2. #2
    Sencha Premium Member
    Join Date
    Jul 2009
    Posts
    111
    Vote Rating
    0
    JacobGu is on a distinguished road

      0  

    Default


    I figured out that the Controller's control events are for Component events only. They do not function on Element events.

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