[CLOSED] Error when binding KeyMap to not active Panel in TabPanel

  1. #1

    [CLOSED] Error when binding KeyMap to not active Panel in TabPanel

    I get an error with the following code. The problem seems to be that you can't bind a KeyMap to a not active Panel in a TabPanel.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Bug2.aspx.cs" Inherits="PagingStoreTest.Bug2" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Viewport ID="Viewport1" runat="server" Layout="VBoxLayout">
            <LayoutConfig>
                <ext:VBoxLayoutConfig Align="Stretch" />
            </LayoutConfig>
            <Items>
                <ext:TabPanel ID="TabPanel1" runat="server" ActiveTabIndex="0">
                    <Items>
                        <ext:Panel ID="Panel1" runat="server" Title="Panel1" Flex="1" Height="300">
                        </ext:Panel>
                        <ext:Panel ID="Panel2" runat="server" Title="Panel2" Flex="1" Height="300">
                        </ext:Panel>
                    </Items>
                </ext:TabPanel>
            </Items>
        </ext:Viewport>
        <ext:KeyMap ID="KeyMap1" runat="server" Target="App.Panel1">
            <ext:KeyBinding Alt="true" StopEvent="true">
                <Keys>
                    <ext:Key Code="W" />
                </Keys>
                <Listeners>
                    <Event Handler="Ext.Msg.alert('Hello','Panel1');" />
                </Listeners>
            </ext:KeyBinding>
        </ext:KeyMap>
        <ext:KeyMap ID="KeyMap2" runat="server" Target="App.Panel2">
            <ext:KeyBinding Alt="true" StopEvent="true">
                <Keys>
                    <ext:Key Code="W" />
                </Keys>
                <Listeners>
                    <Event Handler="Ext.Msg.alert('Hello','Panel2');" />
                </Listeners>
            </ext:KeyBinding>
        </ext:KeyMap>
        </form>
    </body>
    </html>
    Last edited by Daniil; Apr 02, 2012 at 1:55 PM. Reason: [CLOSED]
  2. #2
    Hi,

    By default, non active tabs are not rendered. They are rendered when first time activated.

    To change this behavior you can set up
    DeferredRender="false"
    for the TabPanel.

    See also
    http://docs.sencha.com/ext-js/4-0/#!...deferredRender

    Though it will cause all tabs to be rendered initially - it can decrease the application performance. So, I would suggest to create KeyMaps on the fly via JavaScript within tabs AfterRender listener.

    Also, please read the following related thread:
    http://forums.ext.net/showthread.php?18171
  3. #3
    DeferedRender="false" will work for me.

Similar Threads

  1. [CLOSED] TabPanel - perform page load only when active
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: May 09, 2012, 4:48 PM
  2. [CLOSED] Set active tab tabpanel
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 22, 2011, 8:03 AM
  3. [CLOSED] KeyMap Error MVC2
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 02, 2011, 8:35 PM
  4. Replies: 3
    Last Post: Oct 17, 2010, 1:22 PM
  5. TabPanel set active tab on server
    By logicspeak in forum 1.x Help
    Replies: 1
    Last Post: Aug 25, 2010, 4:40 PM

Tags for this Thread

Posting Permissions