1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    11
    Vote Rating
    1
    NRE is on a distinguished road

      0  

    Default Handle html div click event

    Handle html div click event


    Hi, I've a simple App with a single tab panel with 2 items.
    What I want is switch to the second item by clicking on a banner that is in the first item in the html.
    I've this view:

    Code:
    Ext.define('test.view.Tlist', {
    
        extend: 'Ext.DataView',
        alias: 'widget.mylist',
    	
    	config:{
    		cls: 'tlist',
    		loadingText: 'Caricamento ...',
    		store: Ext.data.StoreManager.get('MyStore'),
    		itemTpl: '<div id="banner"></div><div id="box_menu">{introtext}</div>',
    	
    	}
    });
    How can I open the second item of my App by clicking the "banner" div?
    thank you.

  2. #2
    Sencha User
    Join Date
    Sep 2012
    Posts
    11
    Vote Rating
    1
    NRE is on a distinguished road

      1  

    Default


    Got the solution: I've added a listener as this:

    Code:
    					listeners : {						painted : function(panel) {
    						 var el = panel.element;
    
    
    						el.on('tap', function(e, t) {
    							
    							var image = e.getTarget('img');
    			
    							if (image) {
    																
    								Ext.getCmp("mainpanel").setActiveItem(2);
    							}
    						}, panel);
    					 }
    Thank you anyway.