1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    6
    Vote Rating
    0
    MarwanT is on a distinguished road

      0  

    Default Unanswered: Listeners only work once

    Unanswered: Listeners only work once


    i am having a problem with my application , suppose there is a listener on a button in a certain panel , the listener works fine and the event gets fired in the first time. However , if i revisit this page the listeners wont work.i configure the listener in my controller as follows:
    Code:
    config: { 
     refs:{     
        btn : '#mybtn'     
      }  
    control : 
    {      
        btn : 
    {          
           tap : 'doSmth'   
                }    
            }  
          },  
    doSmth : function () { 
          //some code goes here
      }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Answers
    3356
    Vote Rating
    751
    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


    This is because refs don't like the id config. If you move away from using the id config you will find more success.

    Say you have this button config:

    Code:
    {
        text : 'Save User',
        id   : 'saveUser'
    }
    You will have the issue you are experiencing. But if you do something like this:

    Code:
    {
        text   : 'Save User',
        action : 'saveUser'
    }
    and have your ref use this selector instead of #saveUser:

    Code:
    'button[action=saveUser]'
    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 =NR='s Avatar
    Join Date
    Mar 2013
    Location
    Singapore
    Posts
    91
    Vote Rating
    1
    =NR= is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    This is because refs don't like the id config. If you move away from using the id config you will find more success.

    Say you have this button config:

    Code:
    {
        text : 'Save User',
        id   : 'saveUser'
    }
    You will have the issue you are experiencing. But if you do something like this:

    Code:
    {
        text   : 'Save User',
        action : 'saveUser'
    }
    and have your ref use this selector instead of #saveUser:

    Code:
    'button[action=saveUser]'
    mitchell you one awesome person!!!
    it solved my problem also..

    the only thing is that i think this info can be a lot more helpfull if put on the documentation (especially on the intro section and the tutorial video which tell us on how to connect component to event on controller)

    **how do you know about this?

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar