[CLOSED] Close window issue since getting latest SVN

  1. #1

    [CLOSED] Close window issue since getting latest SVN

    Hi guys,
    Since getting latest SVN this morning, when I close a window after I've completed action (filled fields etc), I get :-

    Unhandled exception at line 18, column 807655 in http://localhost:58966/extjs/ext-all-js/ext.axd?v=13054
    0x800a138f - JavaScript runtime error: Unable to get property 'remove' of undefined or null reference

    The cshtml of this window has not changed between yesterday and today, only the Ext.Net build. If I open and close the window without touching any of the fields it does not error.

    The entire cshtml is included.

    @using CAMS.NLS.Resources
    @using CAMS.Web.UI.ViewModels;
    
    
    <script>
    
        var fnWindowClose = function () {
    
            /* get rid of this window */
            var win = Ext.getCmp('CREATE_NEW_MESSAGE_WINDOW_ID');
            win.destroy();
        };
    
        /*------------------------------------------------------------------------------------------*/
        var fnMessageSendSuccess = function () {
            /* indicate the success */
            toastr.success('@GlobalResources.MessageSendSuccessMessage', '@GlobalResources.MessageSendSuccessTitle');
            App.NEW_MESSAGE_FORM_PANEL.reset();
        };
    
    
        /*------------------------------------------------------------------------------------------*/
        var fnMessageSendFailure = function (result) {
            if (result.errorMessage !== "" && result.errorMessage.indexOf('{') === -1) {
                toastr.error(result.errorMessage,
                             '@GlobalResources.MessageSendFailureTitle',
                         { timeOut: 0, extendedTimeOut: 0 });
                }
                else {
                /* ensure a valid JSON format */
                    var str = result.errorMessage.replace(/success/g, '"success"');
                    str = str.replace(/message/g, '"message"');
                    toastr.error('@GlobalResources.MessageSendFailureMessage : ' + JSON.parse(str).message,
                            '@GlobalResources.MessageSendFailureTitle',
                        { timeOut: 0, extendedTimeOut: 0 });
            }
        };
    
        /*------------------------------------------------------------------------------------------*/
        var fnAdminRecipientSelected = function (item, records) {
            App.RECIPIENT_ID_HIDDEN_ID.setValue(item.value);
            App.RECIPIENT_TEXTFIELD_ID.setValue(item.rawValue);
        };
    
        /*------------------------------------------------------------------------------------------*/
        var fnAssessorRecipientSelected = function (item, records) {
            App.RECIPIENT_ID_HIDDEN_ID.setValue(item.value);
            App.RECIPIENT_TEXTFIELD_ID.setValue(item.rawValue);
        };
    
        /*------------------------------------------------------------------------------------------*/
        var fnUserRecipientSelected = function (item, records) {
            App.RECIPIENT_ID_HIDDEN_ID.setValue(item.value);
            App.RECIPIENT_TEXTFIELD_ID.setValue(item.rawValue);
        };
    
        /*------------------------------------------------------------------------------------------*/
        var fnFileSelected = function (fb, v) {
            if (v) {
                var ctrl = Ext.getCmp('NEW_MESSAGE_ATTACHMENT_FILENAMES_ID');
                if (!(typeof ctrl === "undefined")) {
                    ctrl.setValue(v);
                }
            }
        };
    
        /*------------------------------------------------------------------------------------------*/
        function fnCheckDetails() {
            var recipient = Ext.getCmp('RECIPIENT_TEXTFIELD_ID');
            var title = Ext.getCmp('TITLE_TEXTFIELD_ID');
            var message = Ext.getCmp('MESSAGE_TEXTFIELD_ID');
    
            if (((typeof recipient !== "undefined") && (typeof recipient.value !== "undefined") && (recipient.value != "")) &&
                 ((typeof title !== "undefined") && (typeof title.value !== "undefined") && (title.value != "")) &&
                 ((typeof message !== "undefined") && (typeof message.value !== "undefined") && (message.value != ""))
               ) {
                Ext.getCmp('SEND_BUTTON_ID').show();
            }
            else {
                Ext.getCmp('SEND_BUTTON_ID').hide();
            }
        }
    
    </script>
    
    @model SendUserMessageViewModel
    
    @{
        SendUserMessageViewModel vm = Page.model;
    }
    
    
    @(Html.X().Window()
          .ID("CREATE_NEW_MESSAGE_WINDOW_ID")
          .Layout(LayoutType.Fit)
          .Icon(Icon.ApplicationFormEdit)
          .Title(String.Format("{0} {1} {2}", GlobalResources.Create, GlobalResources.New, GlobalResources.Message ))
          .Border(false)
          .Resizable(true)
          .Draggable(true)
          .Width(900)
          .Modal(true)
          .AutoScroll(true)
          .BodyStyle("background-color:#ffffff;")
          .Padding(10)
          .UI(UI.Info)
    
          .Listeners(ls => ls.Close.Fn = "fnWindowClose")
    
          .Items(
              Html.X().FieldSet()
                  .Cls("cams-fieldset atlas border2")
                  .Title(GlobalResources.Message)
                  .Layout(LayoutType.Anchor    )
                  .AnchorHorizontal("100%")
                  .AnchorVertical("100%")
                  .Defaults(Html.X().Parameter().Name("HideEmptyLabel").Value("false").Mode(ParameterMode.Raw))
                  .Collapsible(false)
                  .Margin(10)
                  .Items(
            
                      Html.X().FormPanel()
                          .ID("NEW_MESSAGE_FORM_PANEL")
                          .Layout(LayoutType.HBox)
                          .LayoutConfig(new HBoxLayoutConfig { Align = HBoxAlign.StretchMax })
                          .DefaultButton("SEND_BUTTON_ID")
                          .Defaults(d =>
                            {
                                d.Add(new Parameter("HideEmptyLabel", "false", ParameterMode.Raw));
                            })
                          .Items(
                      
                              Html.X().HiddenFor(m => Model.AttachmentFileNames)
                                  .ID("NEW_MESSAGE_ATTACHMENT_FILENAMES_ID"),
                                
                      
                              // ------------ Recipients panel ----------------
                              Html.X().Panel()
                                  .Layout(LayoutType.VBox)
                                  .LayoutConfig(new VBoxLayoutConfig { Align = VBoxAlign.StretchMax })
                                  .Width(350)
                                  .Items(
          
                                      Html.X().FieldSet()
                                          .Cls("cams-fieldset atlas border1")
                                          .Title( String.Format("{0} {1}", GlobalResources.Select, GlobalResources.Recipients))
                                          .Layout(LayoutType.Anchor    )
                                          .AnchorHorizontal("100%")
                                          .AnchorVertical("100%")
                                          .Items(                  
    
                                              Html.X().ComboBox() //For(m => Model.AdminRecipient)
                                                  .ID("RECIPIENT_ADMIN_ID")
                                                  .LabelAlign(LabelAlign.Top)
                                                  .LabelSeparator("")
                                                  .FieldLabel(GlobalResources.Administration)
                                                  .Width(250)
                                                  .DisplayField("Name")
                                                  .ValueField("UserId")
                                                  .EmptyText( GlobalResources.SelectRecipient )
                                                  .StoreID("ADMIN_RECIPIENTS_STORE_ID")
                                                  .QueryMode(DataLoadMode.Local)
                                                  .TypeAhead(true)
                                                  .Listeners(l => l.Select.Fn = "fnAdminRecipientSelected")
                                                    .Callouts(co => co.Add( Html.X().Callout()
                                                                                    .Width(150)
                                                                                    .Title("Hint")
                                                                                    .UI(UI.Info)
                                                                                    .ToolbarAlign("Right")
                                                                                    .Trigger(CalloutTrigger.Hover)
                                                                                    .Html("You can use 'type ahead' to quickly select an Administrator.")
                                                                          )
                                                             ),
                                                                                                                                                                                
                                              Html.X().ComboBox() //For(m => Model.AssessorRecipient)
                                                  .ID("RECIPIENT_ASSESSOR_ID")
                                                  .LabelAlign(LabelAlign.Top)
                                                  .LabelSeparator("")
                                                  .FieldLabel( GlobalResources.Assessors)
                                                  .Width(250)
                                                  .DisplayField("Name")
                                                  .ValueField("UserId")
                                                  .EmptyText( GlobalResources.SelectRecipient )
                                                  .StoreID("ASSESSOR_RECIPIENTS_STORE_ID")
                                                  .QueryMode(DataLoadMode.Local)
                                                  .TypeAhead(true)
                                                  .Listeners(l => l.Select.Fn = "fnAssessorRecipientSelected")
                                                    .Callouts(co => co.Add( Html.X().Callout()
                                                                                    .Width(150)
                                                                                    .Title("Hint")
                                                                                    .UI(UI.Info)
                                                                                    .ToolbarAlign("Right")
                                                                                    .Trigger(CalloutTrigger.Hover)
                                                                                    .Html("You can use 'type ahead' to quickly select an Assessor.")
                                                                          )
                                                             ),
                                                                                                                                                                                
                                              Html.X().ComboBox() //For(m => Model.UserRecipient)
                                                  .ID("RECIPIENT_USER_ID")
                                                  .LabelAlign(LabelAlign.Top)
                                                  .LabelSeparator("")
                                                  .FieldLabel(GlobalResources.Users)
                                                  .Width(250)
                                                  .DisplayField("Name")
                                                  .ValueField("UserId")
                                                  .EmptyText( GlobalResources.SelectRecipient )
                                                  .StoreID("USER_RECIPIENTS_STORE_ID")
                                                  .QueryMode(DataLoadMode.Local)
                                                  .TypeAhead(true)
                                                  .Listeners(l => l.Select.Fn = "fnUserRecipientSelected")
                                                    .Callouts(co => co.Add( Html.X().Callout()
                                                                                    .Width(150)
                                                                                    .Title("Hint")
                                                                                    .UI(UI.Info)
                                                                                    .ToolbarAlign("Right")
                                                                                    .Trigger(CalloutTrigger.Hover)
                                                                                    .Html("You can use 'type ahead' to quickly select a User.")
                                                                          )
                                                             )
                                                  
                                                                                                                                                                                
                                          )  // end of Recipients fieldset items
                                  )  // end of Recpients panel items
                                  .Bin(
                                            
                                      Html.X().StoreFor<RecipientInfo>()
                                          .ID("ADMIN_RECIPIENTS_STORE_ID")
                                          .Proxy(Html.X().AjaxProxy()
                                                     .ActionMethods(methods => methods.Read = HttpMethod.GET)
                                                     .Url(Url.RouteUrl("AlternateApi", new { httproute = "", controller = "UserApi", action = "RetrieveMessageAdminRecipients" }))
                                                     .Reader(Html.X().JsonReader().Root("Data"))
                                          )
                                          .AutoLoad(true),
    
                                      Html.X().StoreFor<RecipientInfo>()
                                          .ID("ASSESSOR_RECIPIENTS_STORE_ID")
                                          .Proxy(Html.X().AjaxProxy()
                                                     .ActionMethods(methods => methods.Read = HttpMethod.GET)
                                                     .Url(Url.RouteUrl("AlternateApi", new { httproute = "", controller = "UserApi", action = "RetrieveMessageAssessorRecipients" }))
                                                     .Reader(Html.X().JsonReader().Root("Data"))
                                          )
                                          .AutoLoad(true),
                                                                                                                                                    
                                      Html.X().StoreFor<RecipientInfo>()
                                          .ID("USER_RECIPIENTS_STORE_ID")
                                          .Proxy(Html.X().AjaxProxy()
                                                     .ActionMethods(methods => methods.Read = HttpMethod.GET)
                                                     .Url(Url.RouteUrl("AlternateApi", new { httproute = "", controller = "UserApi", action = "RetrieveMessageUserRecipients" }))
                                                     .Reader(Html.X().JsonReader().Root("Data"))
                                          )
                                          .AutoLoad(true)
                                                                                                                                                    
                                  ),  // end of Recpients panel Bin items           
                                     
                              // --------------- Message Panel ----------------------------            
                              Html.X().Panel()
                                  .Layout(LayoutType.Anchor)
                                  .AnchorHorizontal("100%")
                                  .AnchorVertical("100%")
                                  .Width(480)
                                  .Items(
                                      
                                      Html.X().FieldSet()
                                          .Cls("cams-fieldset atlas border1")
                                          .Title( GlobalResources.Message )
                                          .Layout(LayoutType.Anchor    )
                                          .AnchorHorizontal("100%")
                                          .AnchorVertical("100%")
                                          .Items(                  
    
                                              Html.X().HiddenFor(m => Model.RecipientId)
                                                  .ID("RECIPIENT_ID_HIDDEN_ID"),
    
                                              Html.X().HiddenFor(m => Model.Recipients)
                                                  .ID("RECIPIENTS_IDS_HIDDEN_ID"),
                                                                                                                                          
                                              Html.X().TextField()
                                                  .ID("RECIPIENT_TEXTFIELD_ID")
                                                  .Icon(Icon.User)
                                                  .LabelSeparator("")
                                                  .LabelAlign(LabelAlign.Top)
                                                  .FieldLabel( GlobalResources.Recipient )
                                                  .Selectable(false)
                                                  .Width(450)
                                                  .EmptyText("Selected recipient will appear here")                                                    
                                                  .Listeners(l => l.Change.Fn = "fnCheckDetails"),
                                                
                                              Html.X().Panel().MinHeight(5),
                                                              
                                              Html.X().CheckboxFor(m => Model.IsAlert)
                                                  .IndicatorIcon(Icon.Exclamation)
                                                  .IndicatorText(GlobalResources.MessageTypeIsAnAlert)
                                                  .LabelSeparator("")
                                                  .LabelAlign(LabelAlign.Top)
                                                  .Width(200)
                                                  .FieldLabel(String.Empty),
                                                                                            
                                              Html.X().Panel().MinHeight(5),                                                          
                                                              
                                              Html.X().TextFieldFor(m => Model.MessageTitle)
                                                  .ID("TITLE_TEXTFIELD_ID")
                                                  .Icon(Icon.Pencil)
                                                  .LabelSeparator("")
                                                  .LabelAlign(LabelAlign.Top)
                                                  .FieldLabel( GlobalResources.Title )
                                                  .AutoScroll(true)
                                                  .MinHeight(30)
                                                  .Width(450)
                                                  .EmptyText("Type your message title here")
                                                  .Listeners(l => l.Change.Fn = "fnCheckDetails"),
    
                                              Html.X().Panel().MinHeight(10),
    
                                              Html.X().TextAreaFor(m => Model.MessageText)
                                                  .ID("MESSAGE_TEXTFIELD_ID")
                                                  .Icon(Icon.Pencil)
                                                  .LabelSeparator("")
                                                  .LabelAlign(LabelAlign.Top)
                                                  .FieldLabel( String.Format("{0} {1}", GlobalResources.Your, GlobalResources.Message))
                                                  .AutoScroll(true)
                                                  .Width(450)
                                                  .MinHeight(150)
                                                  .EmptyText("Type your message here")
                                                  .Listeners(l => l.Change.Fn = "fnCheckDetails")
    
                                          ) // end Message Panel items
                                  )
                          ) // end of form panel NEW_MESSAGE_FORM_PANEL
                                              
                  .Buttons(
                            //Html.X().FileUploadField()
                            //        .ID("ATTACHMENT_BUTTON_ID")
                            //        .ButtonOnly(false)
                            //        .Icon(Icon.EmailAttach)
                            //        .MinWidth(350)
                            //        .Flex(1)
                            //        .ButtonText(String.Format("{0} {1}", GlobalResources.Add, GlobalResources.Attachment))
    
                            //        .ToolTips(tt => tt.Add(
                            //            Html.X().ToolTip()
                            //                .Items(
                            //                    Html.X().Label()
                            //                        .Text(GlobalResources.TooltipBrowseForEvidenceToSubmit)
                            //                )
                            //                            )
                            //        )
                            //        .Listeners(l =>
                            //                        {
                            //                            l.Change.Fn = "fnFileSelected";
                            //                        }
                            //                   ),
    
                         Html.X().Button()
                                .ID("SEND_BUTTON_ID")
                                .Border(true)
                                .Center()
                                .Icon(Icon.EmailGo)
                                .Hidden(true)
                                .Text( String.Format("{0} {1}", GlobalResources.Send, GlobalResources.Message))
                                .DirectEvents(de =>
                                    {
                                        de.Click.Url = Url.Action("DirectEventSendMessage", "User");
                                        de.Click.FormID = "NEW_MESSAGE_FORM_PANEL";
                                        de.Click.EventMask.ShowMask = true;
                                        de.Click.IsUpload = true;
                                        de.Click.Before = @"if (!#{NEW_MESSAGE_FORM_PANEL}.getForm().isValid()) { return false; }";
                                        de.Click.Success = "fnMessageSendSuccess(result)";
                                        de.Click.Failure = "fnMessageSendFailure(result)";
                                    }
                                ),
                                
                            Html.X().Button()
                                .Text("Reset Form")
                                .OnClientClick("#{NEW_MESSAGE_FORM_PANEL}.getForm().reset();")
                                              
                  )
                          
                  ) // end of Create New Message fieldset items
          )
    )
    Last edited by Daniil; Apr 01, 2014 at 5:30 PM. Reason: [CLOSED]
  2. #2
    Thank you for the report. We are investigation.

    It is always best to only post the code directly related to the problem. Please ensure you remove all code from samples that are unrelated to the reproducing the issue.
    Geoffrey McGill
    Founder
  3. #3
    I tried to replicate your scenario and was unable to reproduce the error. Maybe, I am missing an important detail.

    To sort the things out we need a runnable test case to reproduce the error. Could you provide, please?
  4. #4
    Quote Originally Posted by Daniil View Post
    I tried to replicate your scenario and was unable to reproduce the error. Maybe, I am missing an important detail.

    To sort the things out we need a runnable test case to reproduce the error. Could you provide, please?
    Hi Daniil,
    OK, I have narrowed it down. If I comment out the .QueryMode(DataLoadMode.Local) line in each ComboBox, I can create/destroy the window without issue (obviously the type ahead will not work). I realise that I really should provide a testable example and I will try and do that in parallel with giving you this extra info. Note that the ComboBoxes are populated via a store and Ajax call.

    The window is instantiated via a panel button with the Controller action returns a partial. I have this method used through my application (so far) without issue.

    The panel code :-
                  .Items(Html.X().Button()
                             .ID("CREATE_NEW_MESSAGE_BUTTON_ID")
                             .Text(String.Format("{0} {1} {2}", GlobalResources.Create, GlobalResources.New, GlobalResources.Message ))
                             .Center()
                             .Icon(Icon.Email)
                             .DirectEvents(de => 
                                            {
                                                     de.Click.Url = Url.Action("RenderCreateNewMessageWindow", "User");
                                                     de.Click.EventMask.ShowMask = true;
                                            }
                             )
    The controller action is :-

            public ActionResult RenderCreateNewMessageWindow()
            {
                var message = new SendUserMessageViewModel();
    
                return new Ext.Net.MVC.PartialViewResult
                {
                    ViewName = "~/Views/Shared/MessageCentre/_CreateNewMessageWindow.cshtml",
                    Model = message
                };
            }
    As I said, if I comment out the .QueryMode(DataLoadMode.Local) line in each ComboBox, I can create/destroy the window at will without issue but if I leave it in and comment out the fnWindowClose listener, I can create the window and then close it successfully. If I then attempt to create it again via the RenderCreateNewMessageWindow action, it will fail. I also have to actually to make a selection in one of the combo boxes to get it to fail. If I don't make a selection, I can create/destroy successfully.

    The error is :-
    Unhandled exception at line 18, column 807655 in http://localhost:58966/extjs/ext-all-js/ext.axd?v=12520
    0x800a138f - JavaScript runtime error: Unable to get property 'remove' of undefined or null reference


    The error occurs at this point in the returned JavaScript ...........

    		removeFilter : function (b, a) {
    			var c = this;
    			if (!c.remoteFilter && c.isFiltered()) {
    				if (b instanceof Ext.util.Filter) {
    					c.filters.remove(b)
    				} else {
    					c.filters.removeAtKey(b)
    				}
    				if (a !== false) {
    					if (c.filters.length) {
    						c.filter()
    					} else {
    						c.clearFilter()
    					}
    				} else {
    					c.fireEvent("filterchange", c, c.filters.items)
    				}
    			}
    		},
    ...... because c.filters is NULL and where b.ID = "RECIPIENT_USER_ID-query-filter".
  5. #5
    For debugging please use a ResourceManager's ScriptMode="Development" or in the <extnet> section in Web.config - scriptMode="Development". Then, for example, meaningless "a", "b", "c", etc. variables will be more meaningful.

    Thank you for the details about the problem. I have reproduced the problem with a test case below and am working on a fix.

    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)
            {
                this.Store1.DataSource = new object[] 
                { 
                    new object[] { "1", "Item 1" },
                    new object[] { "2", "Item 2" },
                    new object[] { "3", "Item 3" }
                };
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:Window runat="server" CloseAction="Destroy">
                <Bin>
                    <ext:Store ID="Store1" runat="server">
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="value" />
                                    <ext:ModelField Name="text" />
                                </Fields>
                            </ext:Model>
                        </Model>
                        <Reader>
                            <ext:ArrayReader />
                        </Reader>
                    </ext:Store>
                </Bin>
                <Items>
                    <ext:ComboBox
                        ID="ComboBox1"
                        runat="server"
                        DisplayField="text"
                        ValueField="value"
                        StoreID="Store1"
                        QueryMode="Local" />
                </Items>
            </ext:Window>
        </form>
    </body>
    </html>
    Last edited by Daniil; Apr 01, 2014 at 12:35 AM.
  6. #6
    It has been fixed in the trunk, revision #5742. It will go the the next public release.

    Thank you for the report.

    Since I don't have your test case, could you, please, update from the trunk, retest and confirm the fix is working for you or not?
  7. #7

    Fixed

    Quote Originally Posted by Daniil View Post
    It has been fixed in the trunk, revision #5742. It will go the the next public release.

    Thank you for the report.

    Since I don't have your test case, could you, please, update from the trunk, retest and confirm the fix is working for you or not?
    Thanks for the tip and I have tested against revision 5743 and it seems to be fixed. Thanks Daniil.

Similar Threads

  1. [CLOSED] Issue with latest from SVN (revision 5459)
    By ATLAS in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Nov 13, 2013, 11:50 AM
  2. Generic Plugin issue in latest version
    By kavitha in forum 2.x Help
    Replies: 1
    Last Post: Oct 03, 2013, 11:07 PM
  3. [CLOSED] Latest SVN issue
    By egodoy in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 16, 2010, 8:22 PM
  4. [CLOSED] [1.0] Issue with VBox Layout in Latest SVN
    By Hari_CSC in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Jul 07, 2010, 5:07 PM
  5. [CLOSED] [1.0] Latest SVN issue with MultiField LabelWidth
    By bsnezw in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Feb 03, 2010, 11:05 AM

Posting Permissions