1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    30
    Answers
    6
    Vote Rating
    2
    gendaful is on a distinguished road

      0  

    Default Answered: Same toolbar used across the views is firing the TAP event multiple times

    Answered: Same toolbar used across the views is firing the TAP event multiple times


    Hi.


    BackGround :
    I am using the same toolbar in all my views which is defined in a separate view. This toolbar has four buttons. Since this button has 'id' attribute,
    tap event on one button from a view will trigger similar tap events from other views as well since the same toolbar is used across the views.


    My Toolbar is as below.


    Ext.define("WU.view.WUToolBar", {
    extend: "Ext.Toolbar",
    alias: "widget.wuToolBar",
    xtype:"wuToolBar",
    config: {
    docked : 'bottom',
    cls : 'tabBar',
    ui:'widgetBottombarUI',
    items : [

    {
    xtype : 'button',
    text : 'My Account',
    cls : 'profileTabBar',
    id : 'myProfileButton',
    listeners : {
    tap : function(button, e, eOpts) {
    console.log('myProfileButton is clicked');


    }


    },
    {
    xtype : 'button',
    text : 'Help',
    cls : 'helpTabBar',
    id : 'helpTabButton',
    listeners : {
    tap : function(button, e, eOpts) {
    console.log('helpButton is clicked');

    }

    },
    ]


    },



    });


    I am adding this to my different views in the items config as below.


    xtype : 'wuToolBar'


    So, tap event on a button in a single view will fires the tap event from all the views since this toolbar is shared across the pages. If I am removing the
    id attribute then application works fine but I need to assign the id to the button since I have to access them using getCmp method.


    Please advise.


    Thanks
    Gendaful

  2. Gendaful,

    You should not rely on ids to get references to your components. Instead consider using

    Component Query
    http://docs.sencha.com/touch/2-1/#!/api/Ext.ComponentQuery

    From our docs:

    For easy access to queries based from a particular Container see the Ext.Container.query, Ext.Container.down andExt.Container.child methods. Also see Ext.Component.up.

    If you are absolutely unable to do this, you can consider using itemId.
    http://docs.sencha.com/touch/2-1/#!/api/Ext.Component-cfg-itemId

    From our docs:
    An itemId can be used as an alternative way to get a reference to a component when no object reference is available. Instead of using an id with Ext.getCmp, use itemId with Ext.Container.getComponent which will retrieveitemId's or id's. Since itemId's are an index to the container's internal MixedCollection, the itemId is scoped locally to the container - avoiding potential conflicts with Ext.ComponentManager which requires a uniqueid.

    Thanks!
    Greg

  3. #2
    Sencha - Support Team
    Join Date
    Mar 2012
    Location
    Lawrence, KS
    Posts
    208
    Answers
    33
    Vote Rating
    30
    greg.barry has a spectacular aura about greg.barry has a spectacular aura about

      0  

    Default No ids

    No ids


    Gendaful,

    You should not rely on ids to get references to your components. Instead consider using

    Component Query
    http://docs.sencha.com/touch/2-1/#!/api/Ext.ComponentQuery

    From our docs:

    For easy access to queries based from a particular Container see the Ext.Container.query, Ext.Container.down andExt.Container.child methods. Also see Ext.Component.up.

    If you are absolutely unable to do this, you can consider using itemId.
    http://docs.sencha.com/touch/2-1/#!/api/Ext.Component-cfg-itemId

    From our docs:
    An itemId can be used as an alternative way to get a reference to a component when no object reference is available. Instead of using an id with Ext.getCmp, use itemId with Ext.Container.getComponent which will retrieveitemId's or id's. Since itemId's are an index to the container's internal MixedCollection, the itemId is scoped locally to the container - avoiding potential conflicts with Ext.ComponentManager which requires a uniqueid.

    Thanks!
    Greg

  4. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    30
    Answers
    6
    Vote Rating
    2
    gendaful is on a distinguished road

      0  

    Default


    Hi Greg. Thanks for the reply. I took an alternative and rather than relying on Ids, I have used css cls as a selector and accessed it using Ext.Select. Your information too was very helpful

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..."