[CLOSED] PropertyGrid - update source before handling the ENTER key after edit

  1. #1

    [CLOSED] PropertyGrid - update source before handling the ENTER key after edit

    I am trying to get an event to fire after the user presses the ENTER key in a propertygrid.

    The event will consume the property grid source values. I can fire the event but the field that took the ENTER still has its previous data value (not the latest value).

    I have tried various combinations of item/grid stopEditing() and completeEdit() but none of those work. How can I get the grid's source to be updated before I go back to the server?

    <%@ Page Language="C#" %>
     
    <script runat="server">
        protected void Populate(object sender, DirectEventArgs e)
        {
            PropertyGridParameter p = new PropertyGridParameter();
            p.Name = "name";
            p.Value = "";
            var editor = new TextField();
            editor.Listeners.SpecialKey.Handler = "if (e.getKey() === e.ENTER) { item.completeEdit(); Ext.Msg.alert('Updated Name', #{PropertyGrid1}.getSource()[0].Value); }";
            p.Editor.Add(editor);
            
            this.PropertyGrid1.SetSource(new PropertyGridParameterCollection() { p }, true);
        }
    </script>
       
    <!DOCTYPE html>
       
    <html>
    <head id="Head1" runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug" SourceFormatting="True" />
       
            <ext:Button ID="Button1" runat="server" Text="Populate" OnDirectClick="Populate" />
            <ext:PropertyGrid ID="PropertyGrid1" runat="server">
                <Source>
                    <ext:PropertyGridParameter Name="initial" Value="property" />
                </Source>
            </ext:PropertyGrid>
    
        </form>
    </body>
    </html>
    Last edited by Daniil; Jul 18, 2014 at 9:19 AM. Reason: [CLOSED]
  2. #2
    Hi @Arbee,

    I can suggest this.
    editor.Listeners.SpecialKey.Handler = "if (e.getKey() === e.ENTER) { Ext.Msg.alert('Updated Name', this.getValue()); }";
  3. #3
    Sorry for misleading you Danil.

    The getValue part of the handler was a replacement for where I reload my store. It was the completeEdit() call that was the problem.

    I have, however, stumbled upon the answer

    App.PropertyGrid1.editingPlugin.completeEdit();
    This causes the store to be updated so that, when I reload my store, the new values are available.

    Thanks again for your great support.
    This can be closed

Similar Threads

  1. [CLOSED] Error in gridPanel after update source from SVN Trunk
    By supera in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 04, 2014, 3:15 PM
  2. How to Update PropertyGrid Values Stored in Database
    By Rahul Yadav in forum 2.x Help
    Replies: 0
    Last Post: Apr 17, 2013, 5:08 AM
  3. PropertyGrid Source empty on direct submit
    By Martijn in forum 1.x Help
    Replies: 0
    Last Post: Sep 14, 2012, 1:35 PM
  4. Replies: 0
    Last Post: Apr 19, 2012, 3:53 PM
  5. Replies: 0
    Last Post: Jan 24, 2010, 9:47 AM

Tags for this Thread

Posting Permissions