Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    dataArrived doesn't fire

    I have a window which contains a form with a selectItem:

    Code:
    { name: "ShowFolder", title: "Folder", editorType: "select",
                 optionDataSource: "DSvuShowFoldersList", valueField: "ShowFolderID", displayField: "Title", pickListWidth: 250,
                 getPickListFilterCriteria: function() {
                     return { ShowID: ShowAdminShowList.selectedShow };
                 },
                 change: function(form, item, value, oldValue) {
                     ShowAdminAssetList.fetchData({ where: " ShowID = " + ShowAdminShowList.selectedShow + ((value == 0) ? " AND ShowFolderID IS NULL " : " AND ShowFolderID = " + value) });
                 },
                 dataArrived: function(startRow, endRow, data) {
                     alert("dataArrived");
                     var dataLength = data.getLength();
                     this.currentShowFolderID = 0;
                     if (data && data.getLength() > 0) {
                         var sfId = data.get(0)["ShowFolderID"];
                         this.setValue(sfId);
                         var showFolderWhere = (sfId == 0) ? " AND ShowFolderID IS NULL " : (" AND ShowFolderID = " + sfId);
                         var assetWhere = " ShowID = " + ShowAdminShowList.selectedShow + showFolderWhere;
                         ShowAdminAssetList.fetchData({ where: assetWhere });
                     }
                 },
                 defaultToFirstOption: true,
                 startRow: true, 
                 endRow: false
    
             },
    When you open the window DataArrived fires as it's supposed to. If you close the parent window and then open it again (the window has the closeClick below) the dataArrived does not fire, even though there is data in it (data must have arrived). Am I not destroying it properly in the first place? I don't see anything in the logs to make me think the object is still around.

    Window Close Click:
    Code:
    closeClick: function(){
    //		            CloseWindowById(this.ID);
    		            this.destroy();
    		            },
    Method on another object which updates the SelectItem:
    Code:
    ShowAdminAssetFilterForm.getField("ShowFolder").fetchData({}, this.updateAssetList(), { ts: isc.timeStamp() });
    Also Tried:
    Code:
    ShowAdminAssetFilterForm.getField("ShowFolder").fetchData();

    #2
    You almost certainly aren't destroying it, hence the cache is retained. Use the Watch Tab or JavaScript Evaluation are of the Developer Console to verify destruction.

    Comment


      #3
      Originally posted by Isomorphic
      You almost certainly aren't destroying it, hence the cache is retained. Use the Watch Tab or JavaScript Evaluation are of the Developer Console to verify destruction.
      Aaaah. OK, What's happening is that when the window is closed:

      I have a destroy on the Window's close click:
      Code:
      closeClick: function(){
      		            this.Super('destroy', arguments)
      		            this.destroy();
      		            },

      The picklist for the selectItem is not being destroyed. Do I have to manually destroy children of the Window (canvas)?

      I assumed that all objects created as children of a canvas were destroyed when the canvas was destroyed. Is this the case, or did I make an ass out of me?

      Comment


        #4
        You're correct about children of Canvii being automatically destroyed. However what you're seeing is data caching, not a component problem. There's an LRU cache of pickList data.

        So, question: is the data in the first case and second case the same, and is the problem just that dataArrived isn't firing (eg, you could re-use the dataset previously loaded).

        If the data should differ, how did it change? Potential parallel changes by other users or something the user does in the current app?

        Comment


          #5
          The funny thing about this is that the data is (nearly) always different.

          I have a ListGrid with a list of "Show" entities. In this listgrid I have the following fire from the recordClick:

          Code:
          ShowAdminAssetFilterForm.getField("ShowFolder").fetchData(this.updateAssetList(), { ts: isc.timeStamp() });
          This populates the picklist. The DataArrived fires, selects the first option in the list and fires a fetch data on another listgrid (assetList).

          If in the Show grid I select a show, it all works fine. I select another show and then select the first show again, it works perfectly. If I close the window which contains all of this and then open a new one, select the first show (or any show), DataArrived does not fire even though data has clearly arrived.

          Another thing I noticed is that the picklist during the first time the window is opened only have the options that were fetched. After re-opening the window, ths picklist's first option is an empty value/display. If that's a clue to anything.

          Comment


            #6
            Signature is wrong, see SelectItem.fetchData().

            Comment


              #7
              Sorry, I switched them in the example in the last post by accident.

              As I have said several times in this thread, the fetch IS working on all records clicked the first time the window is opened.

              Also in your documentation for a picklist:
              void fetchData (callback, requestProperties)


              Either way, I don't need to include properties or a callback, dataArrived does not get run when Data Arrives.

              Comment


                #8
                You've shown a number of different fetchData() calls and they all appear to be wrong. The reason this is important is that passing bad params to fetchData() could plausibly cause dataArrived not to fire.

                You're passing "this.updateAssetList()", if this is intended as a callback, it's incorrect. It's not quoted so it executes immediately, before fetchData() is called.

                You're passing a timestamp; if this is intended as criteria, it's wrong, there is no criteria argument. If you wanted to ensure that the criteria passed are always unique, you should return a timestamp from getPickListFilterCriteria().

                Comment


                  #9
                  I have updated the call to update the picklist:

                  Code:
                  ShowAdminAssetFilterForm.getField("ShowFolder").fetchData();
                  It's still doing the same thing. I think we were on the right track when we were talking about the picklist object not getting destroyed when the container window is destroyed.

                  I'll look into overriding the destroy method on the form object to explicitly destroy the picklist. In the meantime, do you have any other ideas?

                  Paul

                  Comment


                    #10
                    Darn, the picklist is created as a unique isc name such as "isc_PickListMenu_133."

                    How do I get the explicit IDs of the picklist objects (Menu, Body, Body_Vscroll, etc.) of the selectItem in order to destroy them?

                    Comment


                      #11
                      You don't want to destroy them. That's only going to lead to JavaScript errors as you are not meant to access them directly. That's why they have generated ids.

                      Have you already tried the suggested approach of adding a timestamp to the criteria?

                      Comment


                        #12
                        While trying that I have done the following:

                        Code:
                        ShowAdminAssetFilterForm.getField("ShowFolder").fetchData({ ts: isc.timeStamp() });
                        the documentation for 6.5.1 SelectItem.fetchData it has this signature:
                        void fetchData (callback, requestProperties)

                        so I tried:

                        Code:
                        ShowAdminAssetFilterForm.getField("ShowFolder").fetchData("ShowAdminShowList.updateAssetList", { ts: isc.timeStamp() });
                        I know that the signature in the documentation is reversed from what it normally is on objects so I tried:
                        Code:
                        ShowAdminAssetFilterForm.getField("ShowFolder").fetchData({ ts: isc.timeStamp() }, "ShowAdminShowList.updateAssetList");
                        (btw: ShowAdminShowList.updateAssetList does nothing, it's an empty function)


                        All of these have no effect whatsoever on the picklist behavior.


                        Paul

                        Comment


                          #13
                          Right, as previously discussed, there is no criteria argument to SelectItem.fetchData(). The criteria are instead returned by getPickListFilterCriteria(), that's where you would add the timestamp.

                          Comment


                            #14
                            Originally posted by Isomorphic
                            Right, as previously discussed, there is no criteria argument to SelectItem.fetchData(). The criteria are instead returned by getPickListFilterCriteria(), that's where you would add the timestamp.

                            I'm sorry, I failed to mention that I tried that.

                            Code:
                            getPickListFilterCriteria: function() {
                                            return { ShowID: ShowAdminShowList.selectedShow, ts: isc.timeStamp() };
                                         },
                            When you open the select list, "Loading Data..." flashes as it seems to be caught in a loop. Memory usage for firefox goes up at about .5 - 1MB per second and the pickList never gets populated.

                            Comment


                              #15
                              Your results continue to vary wildly from what happens in all of the samples.. pretty soon it's going to be time to ask you to package up a simplified, standalone test case to see if you can get this to happen in a normal SDK.

                              However first, what's going on on the network when this is occurring? Do you see a series of requests in the RPC tab of the Developer Console? Can you tell if the PickList is trying to fetch data and getting bad responses, or responses that don't match the request?

                              Comment

                              Working...
                              X