[FIXED] [#1573] [4.6.0] RemoveAll() causes a Javascript Error on subsequent calls

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [FIXED] [#1573] [4.6.0] RemoveAll() causes a Javascript Error on subsequent calls

    I ran into a interesting bug while creating a dynamic menu in a split button on a directevent. The first time through it worked. Subsequent calls created a javascript error.

    Here is the error:
    ext.axd?v=4.5.1:20 Uncaught TypeError: Cannot read property 'destroy' of null
        at ctor.doRemove (ext.axd?v=4.5.1:20)
        at ctor.remove (ext.axd?v=4.5.1:20)
        at ctor.remove (ext.axd?v=4.5.1:20)
        at ctor.removeAll (ext.axd?v=4.5.1:20)
        at eval (eval at executeScriptDelay (ext.axd?v=4.5.1:249), <anonymous>:1:18)
        at eval (<anonymous>)
        at ctor.executeScriptDelay (ext.axd?v=4.5.1:249)
        at ctor.executeScript (ext.axd?v=4.5.1:249)
        at ctor.requestSuccessHandler (ext.axd?v=4.5.1:242)
        at Object.callback (ext.axd?v=4.5.1:20)
    You can reproduce this issue very simply in this hello world test. Here is a very simple test aspx page.
    <html xmlns="http://www.w3.org/1999/xhtml"><head>
    <script type="text/javascript">
    </script></head><body>    <form id="form1" runat="server">                 <ext:ResourceManager runat="server" ID="rm1" ShowWarningOnAjaxFailure="true" Theme="Triton" >        </ext:ResourceManager>
            <ext:Button runat="server" Text="Launch Window">            <DirectEvents>                <Click OnEvent="Unnamed_Event" />            </DirectEvents>        </ext:Button>                 <ext:Window ID="WinTest" runat="server" Hidden="true" CloseAction="Hide" Title="Testing Dynamically Added Items" Height="200" Width="300">            <Items>                <ext:SplitButton runat="server" ID="ButtonTest" Text="Dynamic Added Items">                    <Menu>                        <ext:Menu ID="MenuDynItems"  runat="server">
                            </ext:Menu>                    </Menu>                </ext:SplitButton>            </Items>        </ext:Window>
    
        </form></body></html>
    Click on on the button to launch the window works 1x. On subsequent calls a javascript error is thrown.
        public partial class test : System.Web.UI.Page
        {
    
    
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
    
    
                }
            }
    
    
            protected void Unnamed_Event(object sender, DirectEventArgs e)
            {
                if (X.IsAjaxRequest)
                {
                    this.MenuDynItems.RemoveAll();
    
    
                    for (int i = 1; i < 5; i++)
                    {
                        var mi = new Ext.Net.MenuItem() { ID = "dynExt-00" + i, Text = "Item 00" + i, IDMode = IDMode.Static };
                        mi.Listeners.Click.Handler = string.Format("alert('{0}')", mi.Text);
                        this.MenuDynItems.Items.Add(mi);
                        mi.Render();
                    }
    
    
    
    
                    this.WinTest.Show();
                }
    
    
    
    
               
            }
        }
    Last edited by fabricio.murta; Jun 15, 2018 at 7:55 PM.

Similar Threads

  1. Replies: 7
    Last Post: Jul 08, 2015, 1:25 AM
  2. Replies: 1
    Last Post: Mar 11, 2015, 8:55 AM
  3. Replies: 1
    Last Post: Mar 06, 2014, 4:21 AM
  4. [CLOSED] Handling Un-Authenticated Ajax calls [401 Error]
    By webclouder in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 22, 2011, 9:49 AM
  5. Replies: 3
    Last Post: Nov 01, 2010, 2:06 PM

Posting Permissions