[CLOSED] [#433] Loop through changed PropertyGridParameters

  1. #1

    [CLOSED] [#433] Loop through changed PropertyGridParameters

    I would like to save only those new values in my gridpanel property.

    Having the example bellow, I tried to check param.IsChanged property, but if one parameter of data source is changed, all parameters return this property as true, even if it was not changed.


    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">   
        protected void Button1_Click(object sender, DirectEventArgs e)
        {
    
            StringBuilder html = new StringBuilder();
            html.Append("CHANGED VALUES:</ BR>");
            html.Append("<table class=\"data\">");
            html.Append("<tr><th>Name</th><th>New Value</th></tr>");
    
            foreach (PropertyGridParameter param in this.PropertyGrid1.Source)
            {
                if (param.IsChanged)
                {
                    html.Append("<tr>");
                    html.Append("<td>" + param.Name + "</td>");
                    html.Append("<td>" + param.Value.ToString() + "</td>");
                    html.Append("</tr>");
                }
            }
            html.Append("</table>");
    
            this.Label1.Html = html.ToString();
    
        }
    
        
    </script>
    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" /> 
             
            <ext:PropertyGrid ID="PropertyGrid1" runat="server" Width="300" SortableColumns="false"
                ForceFit="true">
                <Source>
                    <ext:PropertyGridParameter Name="(name)" Value="Properties Grid" />
                    <ext:PropertyGridParameter Name="grouping" Value="false" Mode="Raw" />
                    <ext:PropertyGridParameter Name="autoFitColumns" Value="true" Mode="Raw" />
                    <ext:PropertyGridParameter Name="productionQuality" Value="false" Mode="Raw" />
                    <ext:PropertyGridParameter Name="created" Value="10/15/2006">
                        <Editor>
                            <ext:DateField ID="DateField2" runat="server" Format="MM/dd/yyyy" />
                        </Editor>
                    </ext:PropertyGridParameter>
                    <ext:PropertyGridParameter Name="tested" Value="false" Mode="Raw">
                        <Renderer Handler="metadata.tdCls = 'red-label'; return value;" />
                    </ext:PropertyGridParameter>
                    <ext:PropertyGridParameter Name="version" Value="0.01" EditorType="Number" />
                    <ext:PropertyGridParameter Name="borderWidth" Value="5" Mode="Raw">
                        <Editor>
                            <ext:NumberField ID="NumberField2" runat="server" />
                        </Editor>
                    </ext:PropertyGridParameter>
                    <ext:PropertyGridParameter Name="color" DisplayName="Color" Value="Red">
                        <Editor>
                            <ext:ComboBox ID="ComboBox2" runat="server" ForceSelection="true">
                                <Items>
                                    <ext:ListItem Text="Red" />
                                    <ext:ListItem Text="Green" />
                                    <ext:ListItem Text="Blue" />
                                </Items>
                            </ext:ComboBox>
                        </Editor>
                        <Renderer Handler="return Ext.String.format('<span style=\'color: {0};\'>{1}</span>', value.toLowerCase(), value);" />
                    </ext:PropertyGridParameter>
                    <ext:PropertyGridParameter Name="trigger" Value="TriggerField" DisplayName="Trigger Field">
                        <Renderer Handler="metadata.tdCls = 'blue-label'; 
                                return value;" />
                        <Editor>
                            <ext:TriggerField ID="TriggerField1" runat="server">
                                <Triggers>
                                    <ext:FieldTrigger Icon="SimpleEllipsis" Tag="ellipsis" />
                                </Triggers>
                                <Listeners>
                                    <TriggerClick Handler="#{PropertyGrid1}.editingPlugin.completeEdit(); 
                                                Ext.Msg.alert('Trigger click', tag + ' trigger click');" />
                                </Listeners>
                            </ext:TriggerField>
                        </Editor>
                    </ext:PropertyGridParameter>
                </Source>
                <Buttons>
                                
                    <ext:Button runat="server" ID="Button5" Text="Get Changed Values">
                        <DirectEvents>
                            <Click OnEvent="Button1_Click" />
                        </DirectEvents>
                    </ext:Button>
                </Buttons>
            </ext:PropertyGrid>
            <ext:Label ID="Label1" runat="server" />
                
        
        </form>
    </body>
    </html>
    By the way, how can I make bold changed values after edit in client side?

    Thanks!
    Last edited by Daniil; Feb 24, 2014 at 3:00 AM. Reason: [CLOSED] [#433]
  2. #2
    Hi @posser,

    Unfortunately, the IsChanged property doesn't work. Created an Issue for that:
    https://github.com/extnet/Ext.NET/issues/433

    Though, I am not sure when it will be fixed. Therefore I would recommend to go in a different way with some manual work. There is the PropertyChange event which you could use to track the changes.
    http://docs.sencha.com/extjs/4.2.1/#...propertychange
  3. #3
    Fixed in SVN. Please update and retest
  4. #4
    It has been fixed the revisions #5678 and #5679 and will go to the v2.5 release.

    Thank you for the report!

Similar Threads

  1. Loop into an existing treepanel
    By springrider in forum 2.x Help
    Replies: 1
    Last Post: May 17, 2012, 3:46 AM
  2. Replies: 4
    Last Post: Dec 02, 2011, 2:42 PM
  3. gridpanel loop
    By maxdiable in forum 1.x Help
    Replies: 4
    Last Post: Jul 09, 2009, 9:37 AM
  4. Replies: 4
    Last Post: May 21, 2009, 12:50 PM
  5. Replies: 3
    Last Post: Dec 10, 2008, 6:32 PM

Tags for this Thread

Posting Permissions