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');
},
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();
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With