Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firing onItemDisclosure event causes itemtap event to fire

i am trying to handle to events on the same list , the first is the itemtap event and the other is the onItemDisclosure event.

When i tap on the arrow , the onItemDisclosure event is fired and handler is executed , however , the itemtap is fired as well , and after the onItemDisclosure handler executes , the itemtap handler is in turn executed.

How can i solve this ?

View :

Ext.define('myapp.view.listview', {   
    requires: [ 'myapp.model.listmodel'],
    extend: 'Ext.List',
    alias:'widget.listview',  
    id : 'listview',
    fullscreen: true,  
config: {

    iconCls: 'list',


    title : 'List',
    onItemDisclosure: function () {
    alert('ok')

    },               

    store:'ListView',  
    itemTpl:'{title}'   


  }
 });

Controller Code :

 Ext.define('myapp.controller.Main', {  
     extend: 'Ext.app.Controller',
    views : ['listview'],
    config : {


    refs:{

        list:'#listview'


    },
    control :{



        listview:{
            itemtap:'display',
            onItemDisclosure : 'disclosure'
        }






    }
},


display:function(){
   alert('tap')
},




disclosure:function (){
    alert('disclosure');
},
like image 478
user1203861 Avatar asked May 31 '12 21:05

user1203861


1 Answers

You need to stop the itemtap event continuing to bubble. First you need the arguments to the function call, then on the event argument you call stopEvent().

disclosure: function(list, record, node, index, event, eOpts) {
    console.log('disclose');        

    event.stopEvent();
},
like image 157
moosekebab Avatar answered Sep 22 '22 16:09

moosekebab