Jul 16, 2014, 6:23 PM
[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?
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]