[CLOSED] Force layout of Button's children

  1. #1

    [CLOSED] Force layout of Button's children

    Hi folks, i would like to know whether it's possible to force the redering of button's menu. In the following example, the Menu's AfterRender event (line 12) is just fired when the button _btn is clicked.

    To overcome this issue it's possible to call Menu's doAutoRender method (Please uncomment from line 16 to 18) after button's rendering, but i'm not sure that it's the best approach to accomplish my needs.

    What you think about it?

    Thanks in advance.

    <ext:Toolbar ID="Toolbar1" runat="server" Width="500">
        <Items>
            <ext:Button ID="_btn" runat="server" Text="Click Me" Icon="Application">
                <Menu>
                    <ext:Menu ID="_mnl" runat="server">
                        <Items>
                            <ext:MenuItem Text="Menu 1" Icon="Accept" runat="server" />
                            <ext:MenuItem Text="Menu 1" Icon="Accept" runat="server" />
                            <ext:MenuItem Text="Menu 1" Icon="Accept" runat="server" />
                        </Items>
                        <Listeners>
                            <AfterRender Handler="alert('Menu was rendered');" />
                        </Listeners>
                    </ext:Menu>
                </Menu>
                <%--<Listeners>
                    <AfterRender Handler="item.menu.doAutoRender();" />
                </Listeners>--%>
            </ext:Button>
        </Items>
    </ext:Toolbar>
    </body>
    </html>
    Last edited by Daniil; Nov 01, 2012 at 5:54 PM. Reason: [CLOSED]
  2. #2
    Hi Raphael,

    I think your approach is good.
  3. #3
    Button's showMenu calls Menu's showBy method, that calls Abstract Component's doAutoRender method, that calls the Render method. When the button is pressed, it will call Menu's showBy again, but the Button's children will not be rendered again because Render method makes the following validation:

    if (!me.rendered && me.fireEvent('beforerender', me) !== false)
    so, the button's children are not rendered twice

    The "stack trace" is a little confusing, but in my opnion there is no performance leak, so i think that it's an acceptable approach.

    Daniil, if you agree, please mark this thread as closed.

    Thank you.
  4. #4
    Can you clarify why do you need it (force menu rendering )?
    Do you need instance of menu? Or menu contains fields which must be submitted?
  5. #5
    I have a GridPanel within Button's Menu. it must be populated when its rendering is complete. So i populate it when AfterRender event is fired but it's just fired when the button is clicked by the first time, otherwise the GridPanel does not exist.
  6. #6
    Geoffrey McGill
    Founder
  7. #7
    Hi Raphael,

    Please clarify is the issue still actual?
  8. #8
    i am gonna prepare an example. please wait until monday.
  9. #9
    Sure, no problem. Thanks.

    NOTE

    Marked closed. Please feel free to update the thread with a sample.
    Last edited by Daniil; Nov 01, 2012 at 5:55 PM.

Similar Threads

  1. [CLOSED] Get Children Nodes of TreePanel
    By softmachine2011 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 04, 2012, 10:00 AM
  2. communication between children
    By threewonders in forum 1.x Help
    Replies: 5
    Last Post: Apr 11, 2012, 11:52 AM
  3. vbox layout is not working on image button
    By robertgan in forum 1.x Help
    Replies: 1
    Last Post: Feb 27, 2012, 9:17 AM
  4. [CLOSED] force do layout for all panel
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 01, 2011, 9:35 AM
  5. [CLOSED] Column layout same height with button row
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 07, 2010, 8:11 AM

Posting Permissions