Threaded View

  1. #1
    Sencha User
    Join Date
    Oct 2009
    Vote Rating
    Albareto is on a distinguished road


    Default Answered: What's the correct way to get the buttons from an Ext.window.Window?

    Hi there,

    I have a Window, something like this:

    var buttons = getButtons(),
        w = Ext.create('Ext.window.Window',
             //config here...
            buttons : buttons
    Then in an event I want to iterate over this buttons, I get the window there but how to get the buttons?

    I have seen that I can get the docked elements and from there the array of buttons, this is a bit overkilling in my opinion, I mean, the code would be like:

    var buttons = [];
    Ext.Array.each(myWindow.getDockedElements(), function(de)
        if (is in the bottom)
              //check if it has buttons, if so then store them in the array
    In Ext 3.X there was a method in the window that returned the buttons, any idea how to get them now?


  2. 1 - Give an itemId to your window:
    PHP Code:
    2- Do whatever you need to do to generate the buttons

    3 - Use Ext.ComponentQuery.query to retrieve the buttons from the window:
    If the buttons are in a toolbar, you can use:
    PHP Code:
    Ext.ComponentQuery.query('myWindow toolbar button'); 
    The code above will return an array of all buttons that are inside a toolbar in your window.

Thread Participants: 3

Tags for this Thread