1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    148
    Answers
    12
    Vote Rating
    10
    pentool will become famous soon enough

      0  

    Default Unanswered: Horizontal list itemTap command

    Unanswered: Horizontal list itemTap command


    Hello,

    I have a horizontal list and I want to detect when one of the items are tapped on. I'm using a sheet because it will be shown/hidden by the user. This code snapshot below does not seem to work. I get "'undefined' is not an object (evaluating 'n.apply') error.

    Code:
    Ext.define('Test.view.NavigationPanel', {
        extend: 'Ext.Sheet',
    
    
        config: {
            ... (various config blah blah)...
        items: [
            {
                    xtype: 'list',
                    ...
                    listeners: {
                        itemtap: {
                            element: 'element',
                            fn: this.onCmdNavigate,
                            scope: this
                       }
                  }
              }
           ]
        },
    
        onCmdNavigate: function(dataview, index, target, record, event, options) {
            console.log('onCmdNavigate');
        }
    });
    However, when I do this, it does work. Basically, I just moved the "onCmdNavigate" function inside the 'itemtap' def.

    Code:
    Ext.define('Test.view.NavigationPanel', {
        extend: 'Ext.Sheet',
    
    
        config: {
            ... (various config blah blah)...
        items: [
            {
                    xtype: 'list',
                    ...
                    listeners: {
                        itemtap: {
                            element: 'element',
                            fn: function(dataview, index, target, record, event, options) {
                                 console.log('onCmdNavigate');
                            },
                            scope: this
                        }
                    }
               }
           ]
        }
    });
    I just would like to understand the concept - which I have a difficult time with. I tried to put the function inside "initialize" event but I can't get it to work regardless how I do it.

    How can I make it work as in the top example, where the 'onCmdNavigate' function is outside the 'listeners' section?

    Thank you!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,795
    Answers
    3466
    Vote Rating
    834
    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


    THe element : 'element' is telling the listener to get placed on the element not component and the itemtap event is on the component.

    And scope : this will make the scope be the window object not anything you are expecting.
    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.

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    148
    Answers
    12
    Vote Rating
    10
    pentool will become famous soon enough

      0  

    Default


    Well, I was just trying to piece things together from examples I've seen. But when I try to put them together and do it a little differently of course they don't work. Nobody really explains the concept behind anything other then throw a line or two samples around. Kinda makes learning tough. So I'm just randomly do things without actually understanding why.

    Hope one day someone will write a good book on the framework.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi