Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractComponent.KeyMap format issue #1466

Closed
fabriciomurta opened this issue Apr 12, 2017 · 2 comments
Closed

AbstractComponent.KeyMap format issue #1466

fabriciomurta opened this issue Apr 12, 2017 · 2 comments
Assignees
Milestone

Comments

@fabriciomurta
Copy link
Contributor

fabriciomurta commented Apr 12, 2017

Found: 4.2.0
Ext.NET forum thread: Keymap in gridpanel not working

The KeyMap config option is currently bound to an Ext.Net.KeyMap component which is not what should be bound there.

This fiddle shows the keys correctly bound using ExtJS 6.2.1 (pure extJS): Component Key Binding Using keyMap

But this MVC view example does not bind keys to a similar window at all:

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>61852 - Keymap not working</title>
</head>
<body>
    <div>
        @Html.X().ResourceManager().ScriptMode(Ext.Net.ScriptMode.Debug).SourceFormatting(true)
        @(
            Html.X().Window()
                .Title("My Window")
                .Width(200)
                .Height(400)
        .CustomConfig(c => c.Add(
            new ConfigItem()
            {
                Mode = ParameterMode.Raw,
                Name = "keyMap",
                Value = "{ a: { handler: function() { Ext.Msg.alert('key pressed', 'you have pressed the key /a/'); } } }"
            }
        ))
        )
    </div>
</body>
</html>
@fabriciomurta fabriciomurta added this to the 4.2.1 milestone Apr 12, 2017
@fabriciomurta fabriciomurta modified the milestones: 4.2.1, 4.3.0 May 17, 2017
fabriciomurta added a commit to extnet/examples5.ext.net that referenced this issue May 21, 2017
KeyMap is broken as per extnet/Ext.NET#1466. And fixing this example
requires fixing the KeyMap functionality.

Related github issue: #15 item 354.
fabriciomurta added a commit to extnet/examples5.ext.net that referenced this issue May 21, 2017
The example is using an alternative way (via listeners) to attain the
same behavior, so it was not completely hidden from EE.

When extnet/Ext.NET#1466 is fixed, the example can again use the KeyMap
component/concept.

This addresses #15 item 353.
@fabriciomurta fabriciomurta self-assigned this Aug 5, 2017
@fabriciomurta
Copy link
Contributor Author

A full-featured syntax was created to handle the intra-components key binding specification, in the supported format for ExtJS.

A test case to explore the feature would be:

<%@ Page Language="C#" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title>Templatey</title>
</head>
<body>
    <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Window ID="w1" runat="server" Title="My Window" Width="200" Height="400">
            <KeyMap>
                <ext:KeyBindItem Key="a" Handler="Ext.Msg.alert('jig', 'saw');" />
                <ext:KeyBindItem Key="ctrl+a" Handler="Ext.Msg.alert('select', 'all');" />
                <ext:KeyBindItem Key="enter" Handler="Ext.Msg.alert('sandman', 'enter');" />
            </KeyMap>
        </ext:Window>
        <%-- Standalone way. Works, but needs to explicitly specify the target, which should already be
         rendered when this kicks in. --%>
        <%--<ext:KeyMap runat="server" Target="w1">
            <Binding>
                <ext:KeyBinding KeysString="a" Handler="Ext.Msg.alert('hey', 'joe')" />
            </Binding>
        </ext:KeyMap>--%>
    </form>
</body>
</html>

fabriciomurta added a commit to extnet/mvc.ext.net that referenced this issue Aug 6, 2017
The new examples illustrates key mapping at component-level (bound to
the viewport in the case), as well as key binding variations.

In MVC Razor syntax, it also illustrates the X.KeyBindItem integrated,
removing the requirement to define it via lambda expressions, but in a
more natural Razor syntax format, and also the intellisense-friendly
@<Text><script> tag support, as well as token expansion support within.

This covers usage of the new approach implemented for key mapping in
ExtJS 6, that was broken/unusable in Ext.NET since version 4.0.0.

Related github issue: extnet/Ext.NET#1466.
fabriciomurta added a commit to extnet/examples5.ext.net that referenced this issue Aug 6, 2017
The new examples illustrates key mapping at component-level (bound to
the viewport in the case), as well as key binding variations.

This covers usage of the new approach implemented for key mapping in
ExtJS 6, that was broken/unusable in Ext.NET since version 4.0.0.

Related github issue: extnet/Ext.NET#1466.
@fabriciomurta
Copy link
Contributor Author

More issues arose while building MVC and using the setter method. They are promptly fixed and will make it to the release.

fabriciomurta added a commit to extnet/examples5.ext.net that referenced this issue Aug 6, 2017
Now the example also shows how dynamic bindings can be done by calling
the component's KeyMap setter method.

Related github issue: extnet/Ext.NET#1466.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant