[FIXED] [#895] [3.3] Extjs Version: 5.1.1.451 Uncaught TypeError: Cannot read property 'setErased' of undefined

  1. #1

    [FIXED] [#895] [3.3] Extjs Version: 5.1.1.451 Uncaught TypeError: Cannot read property 'setErased' of undefined

    hi.

    cs code
    public partial class WebForm3 : System.Web.UI.Page
        {
            private int? insertedValue;
    
            protected void sds_Inserted(object sender, SqlDataSourceStatusEventArgs e)
            {
                if (e.AffectedRows > 0)
                {
                    try
                    {
                        insertedValue = (int)e.Command.Parameters["@new_id"].Value;
                    }
                    catch (Exception ex)
                    {
    
                        insertedValue = null;
                    }
                }
            }
    
            protected void store_AfterRecordInserted(object sender, AfterRecordInsertedEventArgs e)
            {
                if (insertedValue != null)
                {
                    Store store = sender as Store;
    
                    var araModel = store.Model.FirstOrDefault();
    
                    if (araModel != null)
                    {
                        e.Keys.Add(araModel.IDProperty.ToString(), insertedValue);
                    }
    
                    insertedValue = null;
                }
            }
    
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
        }
    source code
    <form id="form1" runat="server">
            <ext:ResourceManager runat="server" />
            <asp:SqlDataSource ID="sdsTest" runat="server" ConnectionString="<%$ ConnectionStrings:Con_Ubs_Write %>" OnInserted="sds_Inserted"
                SelectCommand="SELECT test_id, name FROM test"
                InsertCommand="INSERT INTO test(name) VALUES (@name); SELECT @new_id = SCOPE_IDENTITY();"
                UpdateCommand="UPDATE test SET name = @name WHERE (test_id = @test_id)"
                DeleteCommand="DELETE FROM test WHERE (test_id = @test_id)">
                <DeleteParameters>
                    <asp:Parameter Name="test_id" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="name" />
                    <asp:Parameter Name="new_id" Type="Int32" Direction="InputOutput" />
                </InsertParameters>
                <UpdateParameters>
                    <asp:Parameter Name="name" />
                    <asp:Parameter Name="test_id" Type="Int32" />
                </UpdateParameters>
            </asp:SqlDataSource>
    
            <ext:Store runat="server" ID="storeTest" DataSourceID="sdsTest" OnAfterRecordInserted="store_AfterRecordInserted">
                <Model>
                    <ext:Model runat="server" IDProperty="test_id">
                        <Fields>
                            <ext:ModelField Name="test_id" Type="Int" />
                            <ext:ModelField Name="name" Type="String" />
                        </Fields>
                    </ext:Model>
                </Model>
    
                <Listeners>
                    <Exception Handler="Ext.Msg.alert('Error', response);" />
                    <Write Handler="Ext.Msg.alert('Info', 'successful');" />
                </Listeners>
            </ext:Store>
    
            <ext:GridPanel runat="server" ID="GridPanel1" StoreID="storeTest">
                <ColumnModel>
                    <Columns>
                        <ext:Column runat="server" Text="test_id" DataIndex="test_id" Flex="1" />
                        <ext:Column runat="server" Text="name" DataIndex="name" Flex="1">
                            <Editor>
                                <ext:TextField runat="server" />
                            </Editor>
                        </ext:Column>
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel Mode="Multi" />
                </SelectionModel>
                <Plugins>
                    <ext:CellEditing runat="server" />
                </Plugins>
            </ext:GridPanel>
    
            <ext:Button runat="server" Text="Store Add Records">
                <Listeners>
                    <Click Handler="
                        var store = App.storeTest;
    
                        store.add({ name: 'aa' }, { name: 'bb' });
    
                        " />
                </Listeners>
            </ext:Button>
    
            <ext:Button runat="server" Text="Store Remove Selected Records">
                <Listeners>
                    <Click Handler="
                        var com = App.GridPanel1;
                        var store = App.storeTest;
    
                        Ext.each(com.getSelectionModel().getSelection(), function (sel) {
                            store.remove(sel);
                        });
    
                        " />
                </Listeners>
            </ext:Button>
    
            <ext:Button runat="server" Text="Store sync">
                <Listeners>
                    <Click Handler="
                        var store = App.storeTest;
                        store.sync();
                        " />
                </Listeners>
            </ext:Button>
        </form>
    my problem I get an error in the multi-data deleteds.

    step 1: click button 'Store Add Records' //working.
    step 2: click button 'Store sync' //working.
    step 3: I choose Gridpanel in a recording . //working.
    step 4: click button 'Store Remove Selected Records' //working.
    step 5: click button 'Store sync' //working.

    again
    step 1: click button 'Store Add Records' //working.
    step 2: click button 'Store sync' //working.
    step 3: I choose Gridpanel in multiple records. //working.
    step 4: click button 'Store Remove Selected Records' //working.
    step 5: click button 'Store sync' // error :

    Uncaught TypeError: Cannot read property 'setErased' of undefined
    Ext.cmd.derive.doProcess @ ext.axd?v=19974:19
    Ext.cmd.derive.process @ ext.axd?v=19974:19
    Ext.cmd.derive.processResponse @ ext.axd?v=19974:19
    (anonymous function) @ ext.axd?v=19974:924
    Ext.apply.executeScriptDelay @ ext.axd?v=19974:258
    Ext.apply.executeScript @ ext.axd?v=19974:257
    Ext.apply.requestSuccessHandler @ ext.axd?v=19974:250
    Ext.apply.callback @ ext.axd?v=19974:19
    Ext.cmd.derive.onComplete @ ext.axd?v=19974:19
    Ext.cmd.derive.onStateChange @ ext.axd?v=19974:19
    Ext.Function.i.bind @ ext.axd?v=19974:19
    Deleting the database but <Writer Handler = "ext.msg.alert (' Info ',' successful');" /> does not enter the event. Why ?

    thank you good working.
    Last edited by Daniil; Sep 13, 2015 at 8:42 AM. Reason: [FIXED] [#895] [3.3]
  2. #2
    Hi @siyahgul,

    Please clarify do you use Ext.NET v3, right?

    As for the JavaScript error, it looks like I found related bug reports to Sencha.
    https://www.sencha.com/forum/showthread.php?301217
    https://www.sencha.com/forum/showthread.php?301669

    Please try to add on the page the override from this post:
    Ext.data.ProxyStore.override({
        getRemovedRecords: function () {
            return [].concat(this.removed);
        }
    });
    Created an Issue in Github.
    https://github.com/extnet/Ext.NET/issues/895
  3. #3
    hi brother.

    yes Ext.NET v3.2.1.19974.

    add code in my js file and problem solved. thank you.

    Ext.data.ProxyStore.override({
        getRemovedRecords: function () {
            return [].concat(this.removed);
        }
    });
    Do I have to remove code when this problem fixed ?
  4. #4
    yes Ext.NET v3.2.1.19974.
    In the future please start Ext.NET v3.x related threads in 3.x Premium Help forum, not 2.x. Thank you.

    add code in my js file and problem solved.
    Thank you for confirming!

    The fix has been committed in the revision #6552 (trunk). It goes to the 3.3 release.

    Do I have to remove code when this problem fixed ?
    Yes, if you update from SVN you could remove it.

Similar Threads

  1. Replies: 3
    Last Post: Feb 16, 2015, 3:00 PM
  2. Replies: 2
    Last Post: Aug 13, 2014, 3:01 AM
  3. [CLOSED] Uncaught TypeError: Cannot read property 'items' of null
    By tobros in forum 2.x Legacy Premium Help
    Replies: 10
    Last Post: Nov 20, 2013, 11:45 AM
  4. Replies: 5
    Last Post: Oct 30, 2013, 1:29 PM
  5. Uncaught TypeError: Cannot read property 'items' of null
    By FlavioSilveira in forum 2.x Help
    Replies: 6
    Last Post: Sep 20, 2013, 7:37 PM

Posting Permissions