[CLOSED] GridPanel KeyMap

  1. #1

    [CLOSED] GridPanel KeyMap

    Hi,

    In version 1.x of Ext.NET if I put this inside a gridpanel works and fires the event but now in v2 this markup code doesn't work.

    <ext:GridPanel>
          <KeyMap>
                        <ext:KeyBinding StopEvent="true">
                            <Keys>
                                <ext:Key Code="ENTER" />
                            </Keys>
                            <Listeners>
                                <Event Handler="alert('do some stuff');" />
                            </Listeners>
                        </ext:KeyBinding>
                    </KeyMap>
              </ext:GridPanel>
    Tags gridpanel are only informative to see where I put KeyMap tags.

    Is it related to this change in changelog?
    88. PanelBase KeyMap has been removed. Though we are planning to implement it in one of next releases.
    Otherwise, how can I correct it and get the same result?
    Last edited by Daniil; Jun 26, 2012 at 1:41 PM. Reason: [CLOSED]
  2. #2
    Hi,

    That's right, it is related to the changelog item you have mentioned. The GridPanel class is an inheritor of the PanelBase one.

    Please just define the KeyMap separately.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "test1", "test2", "test3" },
                    new object[] { "test4", "test5", "test6" },
                    new object[] { "test7", "test8", "test9" },
                };
                store.DataBind();
            }
        }
    </script>
    
    <!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>Ext.NET v2 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
    
        <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
            <Store>
                <ext:Store runat="server">
                    <Model>
                        <ext:Model runat="server">
                            <Fields>
                                <ext:ModelField Name="test1" />
                                <ext:ModelField Name="test2" />
                                <ext:ModelField Name="test3" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column runat="server" Text="Test1" DataIndex="test1" />
                    <ext:Column runat="server" Text="Test2" DataIndex="test2" />
                    <ext:Column runat="server" Text="Test3" DataIndex="test3" />
                </Columns>
            </ColumnModel>            
        </ext:GridPanel>
            
        <ext:KeyMap runat="server" Target="={#{GridPanel1}.body}">
            <ext:KeyBinding StopEvent="true">
                <Keys>
                    <ext:Key Code="ENTER" />
                </Keys>
                <Listeners>
                    <Event Handler="alert('do some stuff');" />
                </Listeners>
            </ext:KeyBinding>
        </ext:KeyMap>
    </body>
    </html>
  3. #3
    Ok I'll do like you say.

    Thanks
  4. #4

    How to use ext.net TreePanel in mvc3 to do load data

    How to use ext.net TreePanel in mvc3 to do load data
    like store in grid
  5. #5
    Hi @zhdl,

    Welcome to Ext.NET!

    Please start a new forum thread.

Similar Threads

  1. [CLOSED] GridPanel focus and ENTER keymap
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 12
    Last Post: Dec 29, 2012, 8:04 AM
  2. [CLOSED] KeyMap and IE
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 06, 2011, 2:48 PM
  3. [CLOSED] Keymap key code
    By ogokgol in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 23, 2010, 7:40 AM
  4. Replies: 5
    Last Post: Mar 24, 2010, 5:15 PM
  5. [CLOSED] Inherit KeyMap
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 15, 2009, 10:59 AM

Tags for this Thread

Posting Permissions