Results 1 to 7 of 7

Thread: Get all btns in a container

  1. #1
    Sencha User mkariti's Avatar
    Join Date
    Aug 2011
    Posts
    92

    Default Get all btns in a container

    Hi there,
    Im trying to get all the buttons in a container and I think the best way will be is to somehow group them togather and then run using an each loop on all of them.
    Is there away to somehow group them together? something like class?
    Many thanks
    mkariti

  2. #2
    Sencha Premium User twaindev's Avatar
    Join Date
    Sep 2009
    Posts
    242

    Default

    You can use query to retrieve all buttons in a container:

    Code:
    var buttons = container.query('button');

  3. #3
    Sencha User mkariti's Avatar
    Join Date
    Aug 2011
    Posts
    92

    Default

    Many thanks twaindev,
    How about if I need some of the buttons and not all?
    Cheers
    mkariti

  4. #4
    Sencha Premium User twaindev's Avatar
    Join Date
    Sep 2009
    Posts
    242

    Default

    Then you can do something like this:

    Code:
    var buttons = container.query('button[text=OK]');
    as is described here: Ext.ComponentQuery

  5. #5
    Sencha User mkariti's Avatar
    Join Date
    Aug 2011
    Posts
    92

    Default

    Hi twaindev,
    The first one work like a charm!
    About the second one, I have buttons with mixed text on it so I cant really apply this.
    Cheers
    mkariti

  6. #6
    Sencha Premium User twaindev's Avatar
    Join Date
    Sep 2009
    Posts
    242

    Default

    You can query any attribute, so you'll just have to find/create a common one.

  7. #7
    Sencha User mkariti's Avatar
    Join Date
    Aug 2011
    Posts
    92

    Default

    Great! I will try that!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •