Skip to content Skip to sidebar Skip to footer

Events Order Between Dom Event And Sencha Event

I've a dataview, written with extjs 7.1 modern tookit, with a template with an anchor tag and a select event: https://fiddle.sencha.com/#view/editor&fiddle/34bd Ext.create({

Solution 1:

I'm trying to understand where the user clicks as you suggest but I don't know how.

As @LightNight said, you can use childtap event to run needed handler before select. If you want to understand where the click occurred - just use event.target. Look my example

Solution 2:

how about onItemDisclosure property of list instead of a link?

use onItemDisclosure function and select listener to separate two actions.

onItemDisclosure : Boolean / Function / String / Object BINDABLE

Set to true to display a disclosure icon on each list item. The list will then fire the disclose event, and the event can be stopped before childtap. By setting this config to a function, the function passed will be called when the disclosure is tapped. This can be either a function object or the name of a Ext.app.ViewController method.

Finally you can specify an object with a scope and handler property defined. This will also be bound to the tap event listener and is useful when you want to change the scope of the handler.

xtype: 'list',
itemTpl: [
    '<div class="contact">',
    '<b>',
    '{firstName} {lastName}',
    '</b>',
    '</div>'
],
onItemDisclosure: function (record, btn, index) {
    console.log('Disclosure');
    Ext.Msg.alert('Tap', 'Disclose more info for ' + record.get('firstName'), Ext.emptyFn);
},
store: {

    data: [{
        firstName: 'Peter',
        lastName: 'Venkman'
    }, {
        firstName: 'Raymond',
        lastName: 'Stantz'
    }, {
        firstName: 'Egon',
        lastName: 'Spengler'
    }, {
        firstName: 'Winston',
        lastName: 'Zeddemore'
    }]
},
listeners: {
        select() {
            console.log('select');
        }
}

here is fiddle example

Post a Comment for "Events Order Between Dom Event And Sencha Event"