As you can hear the TabClose with plugin options TabCloseMenu

  1. #1

    As you can hear the TabClose with plugin options TabCloseMenu

    good night,
    With control "TabPanel" need fire an event with its plugin "TabCloseMenu" that giving click the options which are contained: "Close All Tabs, Close Tab, Close Other Tabs" I hear the "TabClose" to trigger I need action, there is also the "TabChange" but this does not help me because I need it to run when I click on the event close one or more tab, bone, the three options that the plugin shows me "TabCloseMenu ". Thank you very much for your attention.

    Ext.net 2.0

    Click image for larger version. 

Name:	Imagen A.jpg 
Views:	51 
Size:	60.2 KB 
ID:	5151

    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
        <title>Adding Tabs On The Fly - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    
        <ext:XScript ID="XScript1" runat="server">
            <script>
                var addTab = function (tabPanel, id, url, menuItem) {
                    var tab = tabPanel.getComponent(id);
    
                    if (!tab) {
                        tab = tabPanel.add({ 
                            id       : id, 
                            title    : url, 
                            closable : true,
                            menuItem : menuItem,
                            loader   : {
                                url      : url,
                                renderer : "frame",
                                loadMask : {
                                    showMask : true,
                                    msg      : "Loading " + url + "..."
                                }
                            }
                        });
    
                        tab.on("activate", function (tab) {
                            #{MenuPanel1}.setSelection(tab.menuItem);
                        });
                    }
                
                    tabPanel.setActiveTab(tab);
                };
    
                var Close = function()
                {
                    alert("tabClose");
                };
            </script>
        </ext:XScript>
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Window ID="Window1"
            runat="server"
            Title="Adding tab"
            Width="700"
            Height="500"
            Icon="Link"
            Layout="BorderLayout">
            <Items>
                <ext:MenuPanel
                    ID="MenuPanel1"
                    runat="server"
                    Width="200"
                    Region="West">
                    <Menu ID="Menu1" runat="server">
                        <Items>
                            <ext:MenuItem ID="MenuItem1" runat="server" Text="Ext.NET">
                                <Listeners>
                                    <Click Handler="addTab(#{TabPanel1}, 'idClt', 'http://www.ext.net', this);" />
                                </Listeners>
                            </ext:MenuItem>
    
                            <ext:MenuSeparator />
    
                            <ext:MenuItem ID="MenuItem2" runat="server" Text="Ext.NET forums">
                                <Listeners>
                                    <Click Handler="addTab(#{TabPanel1}, 'idGgl', 'http://forums.ext.net', this);" />
                                </Listeners>
                            </ext:MenuItem>
    
                            <ext:MenuSeparator />
    
                            <ext:MenuItem ID="MenuItem3" runat="server" Text="Sencha">
                                <Listeners>
                                    <Click Handler="addTab(#{TabPanel1}, 'idExt', 'http://www.sencha.com', this);" />
                                </Listeners>
                            </ext:MenuItem>
                        </Items>
                    </Menu>
                </ext:MenuPanel>
                <ext:TabPanel ID="TabPanel1" runat="server" Region="Center">
                    <Plugins>
                        <ext:TabCloseMenu ID="TabCloseMenu" runat="server" CloseAllTabsText="Close All Tabs"
                            CloseTabText="Close Tab" CloseOthersTabsText="Close Other Tabs" />
                    </Plugins>
                    <Listeners>
                        <TabClose Handler="Close();" />
                    </Listeners>
                </ext:TabPanel>
            </Items>
        </ext:Window>
        </form>
    </body>
    </html>
  2. #2
    Hello!

    Try this one:

    <ext:TabPanel ID="TabPanel1" runat="server" Region="Center">
    	<Plugins>
    		<ext:TabCloseMenu ID="TabCloseMenu" runat="server" CloseAllTabsText="Close All Tabs"
    			CloseTabText="Close Tab" CloseOthersTabsText="Close Other Tabs">
    		</ext:TabCloseMenu>
    	</Plugins>
    	<Listeners>
    		<TabClose Handler="Close();" />
    		<Add Handler="
    			#{TabPanel1}.plugins[0].on('beforemenu', 
    				function(menu) {
    					menu.items.items[0].on('click', 
    						function(menuItem) { 
    							// Your function
    							Ext.Msg.alert('Click', 'Tab Closed'); 
    						}
    					);
    					menu.items.items[2].on('click', 
    						function(menuItem) { 
    							// Your function
    							Ext.Msg.alert('Click', 'All Other Tabs Closed'); 
    						}
    					); 
    					menu.items.items[3].on('click', 
    						function(menuItem) { 
    							// Your function
    							Ext.Msg.alert('Click', 'All Tabs Closed'); 
    						}
    					); 
    				}, this, { single: true }
    			);" Single="True"></Add>
    	</Listeners>
    </ext:TabPanel>
  3. #3
    Quote Originally Posted by Baidaly View Post
    Hello!

    Try this one:

    <ext:TabPanel ID="TabPanel1" runat="server" Region="Center">
    	<Plugins>
    		<ext:TabCloseMenu ID="TabCloseMenu" runat="server" CloseAllTabsText="Close All Tabs"
    			CloseTabText="Close Tab" CloseOthersTabsText="Close Other Tabs">
    		</ext:TabCloseMenu>
    	</Plugins>
    	<Listeners>
    		<TabClose Handler="Close();" />
    		<Add Handler="
    			#{TabPanel1}.plugins[0].on('beforemenu', 
    				function(menu) {
    					menu.items.items[0].on('click', 
    						function(menuItem) { 
    							// Your function
    							Ext.Msg.alert('Click', 'Tab Closed'); 
    						}
    					);
    					menu.items.items[2].on('click', 
    						function(menuItem) { 
    							// Your function
    							Ext.Msg.alert('Click', 'All Other Tabs Closed'); 
    						}
    					); 
    					menu.items.items[3].on('click', 
    						function(menuItem) { 
    							// Your function
    							Ext.Msg.alert('Click', 'All Tabs Closed'); 
    						}
    					); 
    				}, this, { single: true }
    			);" Single="True"></Add>
    	</Listeners>
    </ext:TabPanel>
    Okay, but not what I need, I will contextualize better, suppose this example there are three tabs, then, if you close an active tab (Close Tab) that I trigger an event, if you close all windows (Close All Tabs) that I trigger the event three times, closing the other windows and not the current (Close other Tabs) that I trigger the event twice. Depending on the amount of closed tabs must capture one by one. You can see it in the image A.

    Click image for larger version. 

Name:	Imagen A.jpg 
Views:	51 
Size:	70.4 KB 
ID:	5160
  4. #4
    Try to listen remove event:

    <Listeners>
    	<Remove Handler="if (component.xtype == 'tab') Ext.Msg.notify('Tab closed'); "></Remove>
    </Listeners>
  5. #5
    Quote Originally Posted by Baidaly View Post
    Try to listen remove event:

    <Listeners>
    	<Remove Handler="if (component.xtype == 'tab') Ext.Msg.notify('Tab closed'); "></Remove>
    </Listeners>
    Thank you very much, is what I wanted.

Similar Threads

  1. Replies: 1
    Last Post: Nov 28, 2012, 3:12 AM
  2. Problems with ext: TabCloseMenu
    By billy in forum 2.x Help
    Replies: 2
    Last Post: Oct 16, 2012, 11:38 PM
  3. [CLOSED] TabCloseMenu Localization
    By softmachine2011 in forum 2.x Premium Help
    Replies: 3
    Last Post: Jun 26, 2012, 2:06 PM
  4. [CLOSED] TabCloseMenu plugin firing close event
    By Justin_Wignall in forum 1.x Premium Help
    Replies: 2
    Last Post: Jul 28, 2010, 1:18 PM
  5. [ADDED] [V0.8] Ext.ux.TabCloseMenu i18n text
    By sipo in forum Feature Requests
    Replies: 2
    Last Post: Apr 22, 2009, 4:58 AM

Posting Permissions