[CLOSED] Adding a listener to BeforeDestroy event on TabPanel

  1. #1

    [CLOSED] Adding a listener to BeforeDestroy event on TabPanel

    Hi!

    I create the tabs of my tabPanel with the JavaScript bellow. This javascript create a new tabPanel and load in this new tabPanel a aspx page.
    I wish call a directmethod in aspx page loaded in tabPanel when tabPanel was closed... I wish add a listener to BeforeDestroy event, but I know do this in JavaScript...

    I think that I should add "listener.beforeDestroy.handle = ''this.getBody().App.direct.MyMethod();"... It's correct?

    <script type="text/javascript">
                var addTab = function (tabPanel, contextID, Title) {
                    var tab = tabPanel.getComponent(contextID);
    
                    if (!tab) {
                        tab = tabPanel.add({
                            id: contextID,
                            title: Title,
                            closable: true,
                            loader: {
                                url: "/app/tools/explorerweb/explorerweb.aspx?IDSistema=SGE&ContextID=" + contextID,
                                renderer: "frame",
                                loadMask: {
                                    showMask: true,
                                    msg: "carregando " + Title + "..."
                                }
                            }
                        });
                    }
    
                    tabPanel.setActiveTab(tab);
                };
            </script>
    Last edited by Daniil; Mar 22, 2012 at 1:30 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I would use the BeforeClose event. Please add the following thing into a tab config:
    tab = tabPanel.add({
        ...
        listeners : {
            beforeclose : {
                fn : function (tab) {
                    //Call DirectMethod
                    return false; // To get DirectMethod working, because an iframe will be destroyed.
                                    // You can close a tab within the success/failure DirectMethod handlers.
                }
            }
        }
    });
    You will also need to prevent a tab from closing returning false => to avoid a tab to be destroyed => to get DirectMethod working.
  3. #3
    Works fine!!!

    Thanks a lot, Daniil.

Similar Threads

  1. Replies: 2
    Last Post: May 04, 2012, 1:51 PM
  2. [CLOSED] ext:Button: Adding listener to a click event
    By supera in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 05, 2012, 12:04 PM
  3. [CLOSED] adding listener to dynanically generated accordion
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 12, 2011, 4:37 PM
  4. [CLOSED] adding handler listener in codebehind
    By ashton.lamont in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 05, 2010, 4:50 PM
  5. Adding Tabs With OnActivate Listener
    By juan_pablo in forum 1.x Help
    Replies: 4
    Last Post: Apr 25, 2010, 3:28 PM

Posting Permissions