[CLOSED] Is there any function for formpanel to mark dirty record.

  1. #1

    [CLOSED] Is there any function for formpanel to mark dirty record.

    Just like gridpanel to mark dirty record, So that I can trace formpanel's data is change.
    Last edited by geoffrey.mcgill; Aug 26, 2011 at 9:17 PM. Reason: [CLOSED]
  2. #2
    There is no standard functionality
    You can try the code form the following sample but i am not sure that it will work in all cases
    <%@ Page Language="C#" AutoEventWireup="True" %>
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    
    <!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></title>
        
        <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles">
        </ext:ResourcePlaceHolder>
        
        <script type="text/javascript">
            Ext.override(Ext.form.Field, {
                markDirty: function () {
                    if (this.isDirty() && this.originalValue != this.getValue()) {
                        if (!this.dirtyIcon) {
                            var elp = this.el.parent('.x-form-element');
                            this.dirtyIcon = elp.createChild({
                                cls: 'x-grid3-dirty-cell'
                            });
                            if (Ext.isIE) {
                                this.dirtyIcon.position("absolute", 0, -5, 0);
                            } else {
                                this.dirtyIcon.position("absolute", 0, 0, 0);
                            }
                            this.dirtyIcon.setSize(5, 5);
                        }
                        this.alignDirtyIcon();
                        this.dirtyIcon.show();
                        this.on('resize', this.alignDirtyIcon, this);
                    } else {
                        if (this.dirtyIcon) {
                            this.dirtyIcon.hide();
                        }
                    }
                },
                initEvents: Ext.form.Field.prototype.initEvents.createSequence(function () {
                    this.el.on("change", this.markDirty, this);
                    this.on("change", this.markDirty, this);
                }),
    
    
                alignDirtyIcon: function () {
                    this.dirtyIcon.alignTo(this.el, 'tl', [0, 0]);
                }
            });
    
    
            Ext.override(Ext.form.BasicForm, {
                clearDirty: function () {
                    this.callFieldMethod("markDirty");
                }
            });
        </script>
    </head>
    <body>
    <form id="form1"  runat="server">
        <ext:ResourceManager runat="server"/>
        
        <ext:FormPanel runat="server" Width="400" Height="300" Title="Form">
            <Items>
                <ext:TextField runat="server" />
                <ext:TextField runat="server" />
                <ext:TextField runat="server" />
                <ext:Checkbox runat="server" />
                <ext:ComboBox runat="server">
                    <Items>
                        <ext:ListItem Text="Item 1" />
                        <ext:ListItem Text="Item 2" />
                    </Items>
                </ext:ComboBox>            
            </Items>
            
        </ext:FormPanel>
    </form>
    </body>
    </html>
    Vladimir Shcheglov
    Sr. Developer
  3. #3
    Thank you. It is work .anther question How can I write a javacript to get all field value which is changed?
  4. #4
    Use the following code
    FormPanel1.getForm().getFieldValues(true)
    Vladimir Shcheglov
    Sr. Developer

Similar Threads

  1. [CLOSED] Mark a FormPanel as no longer dirty?
    By dmoore in forum 1.x Premium Help
    Replies: 2
    Last Post: Apr 23, 2012, 7:57 PM
  2. [CLOSED] Store record being marked as dirty
    By GLD in forum 1.x Premium Help
    Replies: 1
    Last Post: Apr 10, 2012, 7:34 PM
  3. How to Mark Ext.net 2.0 FormPanel as Valid?
    By NickBin in forum 2.x Help
    Replies: 1
    Last Post: Mar 22, 2012, 12:33 PM
  4. [CLOSED] How to get all dirty record from a gridpanel
    By xian.xu in forum 1.x Premium Help
    Replies: 2
    Last Post: Aug 26, 2011, 12:21 AM
  5. How to set Grid record dirty?
    By speddi in forum 1.x Help
    Replies: 0
    Last Post: Jul 16, 2010, 8:47 PM

Tags for this Thread

Posting Permissions