Dynamic DirectEvents

  1. #1

    Dynamic DirectEvents

    Hi,

    In my MVC application I want to perform an action where a windows is closed.

    I can do that from a button in my menu as follows:

    <ext:Button runat="server" Icon="Cancel" ToolTip="Close window">
    <DirectEvents>
    <Click Url='<%# Url.Action("Close") %>' AutoDataBind="true">
    <ExtraParams>
    <ext:Parameter Name="ci" Value="#{Store1}.getAt(0).id" Mode="Raw" />
    </ExtraParams> 
    </Click>
    </DirectEvents>
    <Listeners>
    <Click Delay="100" Handler="parentWindow.close();" />
    </Listeners>
    </ext:Button>
    But my windows are created dinamically, so I would like to know how to create DirectEvents to perform the same when user click the close x-cross icon. I can dettect windows close event in this way:

    w.on("beforeclose", function () { alert('adios close'); });
    And I think I can aldo add listeners options when I create windows dynamically:

    But how can I do the same with DirectEvents?

    Has anyone knows to perform this in some other way in order to call an action in my Controller?

    Thanks in advance,

    Dominik.

    Last edited by geoffrey.mcgill; Jul 30, 2010 at 5:05 PM. Reason: please use [code] tags
  2. #2
    Hi again,

    I can change window autoLoad url, but how can I reload it?

    window reload() method is not working for me...

    Some other way to solve problem described in first post will will be greatly appreciated‎.

    Thanks in advance,

    Dominik.
  3. #3
    Hi,

    Do you create window via javascript? You can add the following code to the wondow config object
    directEvents: {
                    close: {
                        fn: function (el) {
                            Ext.net.DirectEvent.request({
                                cleanRequest: true,
                                type: "load",
                                url: "/Controller/action",
                                method: "POST",
                                control: this
                            });
                        },
                        delay: 20
                    }
                }
  4. #4
    Thanks,

    It works OK!!

Similar Threads

  1. [CLOSED] Dynamic created MenuItems and directEvents
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Jun 14, 2012, 5:04 PM
  2. Replies: 12
    Last Post: Sep 20, 2011, 2:33 PM
  3. [CLOSED] Dynamic DirectEvents
    By albayrak in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 10, 2011, 9:12 AM
  4. Replies: 0
    Last Post: Mar 04, 2011, 6:46 AM
  5. Dynamic Menu with DirectEvents
    By Ganesh3.shirsath in forum 1.x Help
    Replies: 4
    Last Post: Oct 16, 2010, 6:01 PM

Posting Permissions