[CLOSED] Editable grid with server paging with Store warning on dirty = true leads to JavaScript error

  1. #1

    [CLOSED] Editable grid with server paging with Store warning on dirty = true leads to JavaScript error

    I have an editable grid with server side paging. I set the store to warn on dirty. If I edit some grid contents on page 1 and try to go to the next page, I correctly get the Store confirmation about being sure to reload data. If I click yes, I get a JavaScript error:

    this.originalLoad is not a function
    Here is an example to reproduce it:

    <%@ Page Language="C#" %>
    <script runat="server">
        public class Data
        {
            public int Id { get; set;}
            public string Name { get; set;}
            
            public static List<Data> SampleData
            {
                get
                {
                    var data = new List<Data>();
                    for (int i = 0; i < 10; i++)
                    {
                        data.Add(new Data { Id = i, Name = "Blah " + i });
                    }
                    return data;
                }
            } 
        }
            
        protected void Store1_ReadData(object sender, StoreReadDataEventArgs e)
        {
            int start = e.Start;
            int limit = e.Limit;
            
            Paging<Data> data = GetData(start, limit);
    
    
            e.Total = data.TotalRecords;
    
    
            Store1.DataSource = data.Data;
            Store1.DataBind();
        }
    
    
        private static Paging<Data> GetData(int start, int limit)
        {
            var data = Data.SampleData;
            int totalNumber = data.Count;
            int numberToGet = start + limit > totalNumber ? totalNumber - start : limit;
    
    
            return new Paging<Data>(data.GetRange(start, numberToGet), totalNumber);
        }
    </script>
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Simple Grid - Ext.NET Examples</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
    
    
        <ext:Viewport runat="server" Layout="fit">
            <Items>
                <ext:GridPanel runat="server" Title="Simple Grid">
                    <Store>
                        <ext:Store
                            Id="Store1"
                            OnReadData="Store1_ReadData"
                            runat="server"
                            PageSize="5"
                            RemoteSort="true"
                            WarningOnDirty="true">
                            <Model>
                                <ext:Model runat="server" IDProperty="Id">
                                    <Fields>
                                        <ext:ModelField Name="Id" Type="Int" />
                                        <ext:ModelField Name="Name" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                            <Proxy>
                                <ext:PageProxy />
                            </Proxy>
                        </ext:Store>
                    </Store>
                    <ColumnModel>
                        <Columns>
                            <ext:Column Text="Id" DataIndex="Id" Width="25" />
                            <ext:Column Text="Name" DataIndex="Name" Flex="1">
                                <Editor>
                                    <ext:TextField runat="server" />
                                </Editor>
                            </ext:Column>
                        </Columns>
                    </ColumnModel>
                    <Plugins>
                        <ext:CellEditing runat="server" />
                    </Plugins>
                    <BottomBar>
                        <ext:PagingToolbar runat="server" />
                    </BottomBar>
                </ext:GridPanel>
            </Items>
        </ext:Viewport>    
    </body>
    </html>
    Looking in the JavaScript debugger, it looks to me the problem is here:

    _load : Ext.data.Store.prototype.load,
    
    
    load : function (options) {
        if (this.warningOnDirty && this.isDirty()) {
            Ext.Msg.confirm(
                this.dirtyWarningTitle,
                this.dirtyWarningText,
                function (btn, text) {
                    if (btn == "yes") {
                        this.originalLoad(options); // <-- this is the line failing
                    }
                },
                this
            );
            return this;
        }
        return this._load(options);
    },
    I've not studied the file fully, but just looking at the above snippet, I suspect that instead of calling this.originalLoad(options); it should be using this._load(options)?

    Thanks!
    Last edited by Daniil; Jun 07, 2012 at 4:21 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Thanks for the report. Fixed in SVN, revision #4071.
  3. #3
    Thanks for the fix. Looks good; you can mark as closed.

Similar Threads

  1. Editable Checkcolumn gives javascript error
    By Birgit in forum 2.x Help
    Replies: 2
    Last Post: Apr 19, 2012, 11:56 AM
  2. [CLOSED] Create Editable Grid from server side
    By Marcelo in forum 1.x Premium Help
    Replies: 2
    Last Post: Sep 15, 2011, 1:31 PM
  3. Replies: 2
    Last Post: Apr 20, 2010, 1:50 PM
  4. [CLOSED] [1.0] Store and paging server side
    By PoloTheMonk in forum 1.x Premium Help
    Replies: 1
    Last Post: Feb 02, 2010, 12:38 PM
  5. How to check if Form or Editable Grid is Dirty ?
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 1
    Last Post: Aug 31, 2009, 5:03 PM

Posting Permissions