1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    England
    Posts
    135
    Vote Rating
    7
    Answers
    11
    george.m is on a distinguished road

      0  

    Default Unanswered: List itemtap event not firing anymore.

    Unanswered: List itemtap event not firing anymore.


    I have been using the same method of event handling throughout my application, but now that I have changed the structure of one of my views, I can't seem to get the itemtap event to fire anymore.

    Previously, my view was a list within a container and I could get the event to fire, but now that I have converted the container itself into a list (to prevent over-nesting), I'm having problems.

    The code that is of interest is that in bold, and the 'console.log' isn't being executed.

    Any help would be greatly appreciated.

    Code:
    Ext.define("App.view.Premises", {
        extend: 'Ext.dataview.List',
        requires: ['Ext.field.Select'],
        alias: 'widget.premises',
    
    
        config: {
            itemId: 'premises-list',
            title: 'Premises',
        onItemDisclosure: true,
        layout: 'fit',
        store    : 'Premises',
        itemTpl: '<div>{buildingName}</div>'+
                '<div class="town">{town}</div>',
            items: [{
                xtype    :'toolbar',
                docked    : 'top',
                items: [{
                    xtype: 'selectfield',
                    itemId: 'town-select',
                    store    : 'Regions',
                    displayField: 'region',
                    valueField:'value' 
                }]
            },{
                xtype    : 'container',
                id        : 'region-message',
                cls        : 'region-message',
                html    : 'To begin, please choose a region from the selectfield above.'
            }],
            
        listeners: [{
            delegate    : '#premises-list',
            event        : 'itemtap',
            fn            : 'listItemTap'
        },{
            delegate    : 'selectfield',
            event        : 'itemselected',
            fn            : 'townFilter'
        },{
            delegate    : 'selectfield',
            event        : 'blur',
            fn            : 'townFilter'
        }]
    },
    listItemTap: function(dataView, index, target, record, e, eOpts){
        console.log('test');
        this.fireEvent('showAudits', this, index);
    },
           townFilter: function(){
            this.fireEvent('filterByTown', this);
           }
    });
    Note: if I run the following code in the console, I can get the event to fire, but I want to prevent having to do this:

    Code:
    Ext.ComponentQuery.query('#premises-list')[0].on('itemtap', function(){ alert() })

  2. #2
    Sencha User
    Join Date
    Nov 2011
    Location
    England
    Posts
    135
    Vote Rating
    7
    Answers
    11
    george.m is on a distinguished road

      0  

    Default


    I have decided to completely refactor the way I handle events now so ignore this post please.