Hybrid View

  1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    139
    Vote Rating
    3
    jeanluca is on a distinguished road

      0  

    Default 'ref' buttons by classname (in a controller)

    'ref' buttons by classname (in a controller)


    Hi

    I have two logout buttons (each on a different panels), for which I want to do something when they're tapped. I have added a class value of 'logout' to both of them and the following controller setup:

    Code:
           .....
           ref: {
                 logoutButtons: 'button[class~="logout"]' // should match both buttons
           },
           control: {
                logoutButtons: {
                      tap: 'onLogout'
                }
          }
          ....
    Well, this doesn't work, any suggestions how to fix this ?

    Thanks
    Luca

  2. #2
    Sencha User netresource's Avatar
    Join Date
    Oct 2011
    Posts
    23
    Vote Rating
    0
    netresource is on a distinguished road

      0  

    Default


    you can do below
    Code:
            refs: {
                logoutButton:{
                    selector: '[cls="logout"]'
                }
            },
           control: {
                logoutButton:{
                        tap: 'onLogoutTap'
                }
           }

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Posts
    139
    Vote Rating
    3
    jeanluca is on a distinguished road

      0  

    Default


    check, it works now! Thanks a lot!!

  4. #4
    Sencha User
    Join Date
    Aug 2012
    Location
    Vancouver, Canada
    Posts
    31
    Vote Rating
    1
    trevorcox is on a distinguished road

      0  

    Default


    Worked for me in 2.2.1; now broken in 2.4. I switched to creating a button with its own xtype.

  5. #5
    Sencha User
    Join Date
    Feb 2013
    Posts
    27
    Vote Rating
    1
    Keab42 is on a distinguished road

      0  

    Default


    They've changed the functionality of searching by cls selectors in 2.4. It seems that it now searches for the full cls string which invariably also adds a few x- classes from the framework. 2.4.1 will apparently contain a fix for this: http://www.sencha.com/forum/showthre...-Refs-by-Class

  6. #6
    Sencha User
    Join Date
    Oct 2014
    Posts
    2
    Vote Rating
    0
    tt1987 is on a distinguished road

      0  

    Default


    you can do belowCode: refs: { logoutButton:{ selector: '[cls="logout"]' } }, control: { logoutButton:{ tap: 'onLogoutTap' } }thank you I did not succeed