Hybrid View

  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    2
    Vote Rating
    0
    pawelp7 is on a distinguished road

      0  

    Default Answered: Click event handler problem

    Answered: Click event handler problem


    Hi!

    I am considering if it's possible to call setActiveItem from button's click event handler. I'm using Sencha Architect, I've tried several methods, but without luck. I was trying to run the code:

    Code:
    onMenuitemClick: function(item, e, options) {
           
         //alert('Item clicked!'); //thats working
      
      Ext.getCmp('MyForm') ; //return undefined
            //Ext.getCmp('MyForm').getLayout().setActiveItem(1);
    }
    I would be very grateful for any help.

  2. ok
    Ext.getCmp(...) searches for a component with the matching config id.
    Does your form have an id of "myForm".
    I suspect not.

    What is better practice is to set an itemId on your form and use the button "up" method to find the form.
    See - http://docs.sencha.com/touch/2-1/#!/...tton-method-up

    Now this is using a component query relative to the button looking up. See Ext.ComponentQuery in the API for details around query selectors (you could use Ext.ComponentQuery singleton to find the form as well).

    http://docs.sencha.com/touch/2-0/#!/...ComponentQuery

    Assumming you give your form the itemid of "baseForm" your button query would look like.

    button.up('#baseForm');

    Good luck

  3. #2
    Touch Premium Member suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    447
    Answers
    21
    Vote Rating
    62
    suzuki1100nz is a jewel in the rough suzuki1100nz is a jewel in the rough suzuki1100nz is a jewel in the rough suzuki1100nz is a jewel in the rough

      1  

    Default


    ok
    Ext.getCmp(...) searches for a component with the matching config id.
    Does your form have an id of "myForm".
    I suspect not.

    What is better practice is to set an itemId on your form and use the button "up" method to find the form.
    See - http://docs.sencha.com/touch/2-1/#!/...tton-method-up

    Now this is using a component query relative to the button looking up. See Ext.ComponentQuery in the API for details around query selectors (you could use Ext.ComponentQuery singleton to find the form as well).

    http://docs.sencha.com/touch/2-0/#!/...ComponentQuery

    Assumming you give your form the itemid of "baseForm" your button query would look like.

    button.up('#baseForm');

    Good luck

  4. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    2
    Vote Rating
    0
    pawelp7 is on a distinguished road

      0  

    Default


    Thanks! I added an ID for main panel and ended with something like
    Code:
    button.up('#baseForm').layout.setActiveItem(1);
    in my button event handler. Now it works!

Thread Participants: 1

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