1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    86
    Vote Rating
    1
    Answers
    4
    busaware1 is on a distinguished road

      0  

    Default Answered: Disclose doesnt fire if itemtap event defined - ST2.1

    Answered: Disclose doesnt fire if itemtap event defined - ST2.1


    Hi,

    I have a list with disclose button and associated event - works fine.

    On the list I have a field which I want to capture the itemtap event on.

    When I add the 'itemtap' event on the list the disclose event is no longer fired.

    I've read some posts (look like earlier versions of ST2 where you can look for the disclose class - along the lines of the code below within the itemtap. However this class name never comes up when I click/press on it - in fact the item tap doesnt fire either (when pressing on the disclose button). It seems that once you have defined an itemtap event the disclose event never fires.

    Code:
    if (e.target.className == 'x-list-disclosure') {
                console.log("disclose");
            }
    Can anyone help me with having both events working on a list.
    Also I'd rather not have to use a dataitem component if possible.

    any help is greatly appreciated.
    cheers

  2. That's because you have the same properties, this is how javascript works. Try this:

    Code:
    control : {
        'MyGrid' : {
            disclose : 'onMyGridDisclose',
            itemtap : 'onMyGridItemtap'
        }
    }

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Just tried this with 2.1.0 and it works:

    Code:
    Ext.Viewport.setActiveItem({
        xtype            : 'list',
        itemTpl          : '{test}',
        onItemDisclosure : true,
        store            : {
            fields : ['test'],
            data   : [
                { test : 'One' }
            ]
        },
        listeners        : {
            itemtap  : function () {
                console.log('itemtap');
            },
            disclose : function () {
                console.log('disclose');
            }
        }
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    86
    Vote Rating
    1
    Answers
    4
    busaware1 is on a distinguished road

      0  

    Default


    Hi,
    Doesn't work for me - when they are in MVC - events from a controller as per below - if the itemtap event is defined the disclose event never fires on click/tap of the disclose button in the list...
    If I remove the itemtap handler then the disclose event fires.

    e.g.

    Code:
    Ext.define('Myapp.view.mygrid', {
        extend: 'Ext.dataview.List',
        xtype: 'MyGrid', 
        config: {
            itemId: 'mygrid',
            store: 'MyStore',
            itemTpl: myTpl,
            onItemDisclosure: true, 
            iconMask: true,
            flex: 1 
        }
    });
    from controller:
    Code:
       control: {
              
                'MyGrid': {
                   disclose: 'onMyGridDisclose'
                }
                ,
                'MyGrid': {
                    itemtap: 'onMyGridItemtap'
                }
            },
      
    <<SNIP>>
    
    onMyGridItemtap: function (list, index, target, record, event) {
      console.log("item tap -fires!");
       }
    ,
      onMyGridDisclose: function (list, record, target, index) {
      console.log("disclose -fires!");
    }

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    That's because you have the same properties, this is how javascript works. Try this:

    Code:
    control : {
        'MyGrid' : {
            disclose : 'onMyGridDisclose',
            itemtap : 'onMyGridItemtap'
        }
    }
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    86
    Vote Rating
    1
    Answers
    4
    busaware1 is on a distinguished road

      0  

    Default


    thanks!
    I had not seen this syntax before for two events on the same object.

Thread Participants: 1

Tags for this Thread