[CLOSED] autosave on gridpanel

  1. #1

    [CLOSED] autosave on gridpanel

    Hi,

    in my application I've an editable GridPanel. I'd like to save the data automatically when leaving the ROW on which I made the changes.
    I tried to set AutoSave = true on the Store but save event triggers after each cell modification.

    Could you suggest a method to accomplish this?

    Bye,
    Stefano
    Last edited by geoffrey.mcgill; Feb 09, 2011 at 5:12 PM. Reason: [CLOSED]
  2. #2
    Hi,

    To determine change of row I can suggest you to use Focus listener of editors.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "test11", "test12", "test13" },
                    new object[] { "test12", "test22", "test23" },
                    new object[] { "test13", "test32", "test33" }
                };
                store.DataBind();
            }
        }
    </script>
    
    <!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>Ext.Net Example</title>
    
        <script type="text/javascript">
            var onFocus = function() {
                if (Ext.isDefined(this.grid.grid.view.editorFocus.row) 
                    && (this.grid.row != this.grid.grid.view.editorFocus.row)) {
                    
                    alert('row changed'); 
                }
            }
        </script>
    
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
            <Store>
                <ext:Store runat="server">
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="test1" />
                                <ext:RecordField Name="test2" />
                                <ext:RecordField Name="test3" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test1" DataIndex="test1">
                        <Editor>
                            <ext:TextField runat="server">
                                <Listeners>
                                    <Focus Fn="onFocus" />
                                </Listeners>
                            </ext:TextField>
                        </Editor>
                    </ext:Column>
                    <ext:Column Header="Test2" DataIndex="test2">
                        <Editor>
                            <ext:TextField runat="server">
                                <Listeners>
                                    <Focus Fn="onFocus" />
                                </Listeners>
                            </ext:TextField>
                        </Editor>
                    </ext:Column>
                    <ext:Column Header="Test3" DataIndex="test3">
                        <Editor>
                            <ext:TextField runat="server">
                                <Listeners>
                                    <Focus Fn="onFocus" />
                                </Listeners>
                            </ext:TextField>
                        </Editor>
                    </ext:Column>
                </Columns>
            </ColumnModel>
            <Plugins>
                <ext:EditableGrid runat="server" />
            </Plugins>
        </ext:GridPanel>
        </form>
    </body>
    </html>

Similar Threads

  1. Store AutoSave
    By cwolcott in forum 1.x Help
    Replies: 5
    Last Post: Jan 09, 2012, 11:26 PM
  2. [1.2] Postback on null values with autosave
    By hc.dev in forum 1.x Help
    Replies: 4
    Last Post: Jan 04, 2012, 4:52 PM
  3. Grid with AutoSave sample
    By PetrSnobelt in forum 1.x Help
    Replies: 3
    Last Post: Apr 27, 2011, 11:33 AM
  4. [CLOSED] Gridpanel - RowEditor - Autosave
    By jthompson in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 05, 2011, 8:39 AM
  5. [1.0] Examples Explorer | GridPanel > Update > AutoSave
    By r_honey in forum Open Discussions
    Replies: 3
    Last Post: Apr 29, 2010, 5:12 AM

Posting Permissions