3 Replies Latest reply on Sep 4, 2008 12:04 PM by Newsgroup_User

    Switching array collection

    vikceo
      I have an arraycollection defined in my mx:script as:

      private var topLevelTabs:Array = new Array();
      [Bindable]
      public var categories:ArrayCollection = new ArrayCollection(topLevelTabs);

      in the initlalization of the app i m calling a method vich calls below method: (worklistInfo is an XML file i already have and passing it)

      public function getTopLevelGroups(worklistInfo:XML, groupType:String="Category"):void{
      var arr:Array;
      if(groupType == "Category")
      arr = VStack.getTabs(getWorklistCategories(worklistInfo));
      else if(groupType == "Expiration Date")
      arr = VStack.getTabs(loadByExpiryDate(worklistInfo));

      topLevelTabs = arr;
      categories.source = arr;
      categories.refresh();
      } //end getTopLevelGroups()


      This renders the application with data as expected. There is a button in my app on click of which i call the getTopLevelGroups by passing the worklistinfo and groupType = "Expiration Date"

      In this case it does not refresh my app with the new data. I have properly verified the things like method is called properly, and it is not coming null etc. In the above method i tried printing the contents of the arraycollection when control goes to it on click of the button. I am able to see the new values.

      Please suggest why it is not showing it all on the ui?

      Thankx and regards
      Vik
        • 1. Re: Switching array collection
          vikceo Level 1
          ok so with the help of Amy.. and hard work on my side.. the issue is.. it things are switching perfectly but the component was not able to refresh.

          Actually, i have created a custom component which takes this arraycollection rows as parameter. to make it work after changing the arraycollection and refresh I need to manually call the invalidateProperties() method of my custom component.

          But, this is kinds of not a real good thing..I should not need to call..

          any comments?
          • 2. Re: Switching array collection
            Level 7
            When you keep starting new threads like that, it makes it impossible to
            follow what's going on. Good luck!

            "vikceo" <webforumsuser@macromedia.com> wrote in message
            news:g9p6qi$lj1$1@forums.macromedia.com...
            >I have an arraycollection defined in my mx:script as:
            >
            > private var topLevelTabs:Array = new Array();
            > [Bindable]
            > public var categories:ArrayCollection = new ArrayCollection(topLevelTabs);
            >
            > in the initlalization of the app i m calling a method vich calls below
            > method:
            > (worklistInfo is an XML file i already have and passing it)
            >
            > public function getTopLevelGroups(worklistInfo:XML,
            > groupType:String="Category"):void{
            > var arr:Array;
            > if(groupType == "Category")
            > arr = VStack.getTabs(getWorklistCategories(worklistInfo));
            > else if(groupType == "Expiration Date")
            > arr = VStack.getTabs(loadByExpiryDate(worklistInfo));
            >
            > topLevelTabs = arr;
            > categories.source = arr;
            > categories.refresh();
            > } //end getTopLevelGroups()
            >
            >
            > This renders the application with data as expected. There is a button in
            > my
            > app on click of which i call the getTopLevelGroups by passing the
            > worklistinfo
            > and groupType = "Expiration Date"
            >
            > In this case it does not refresh my app with the new data. I have properly
            > verified the things like method is called properly, and it is not coming
            > null
            > etc. In the above method i tried printing the contents of the
            > arraycollection
            > when control goes to it on click of the button. I am able to see the new
            > values.
            >
            > Please suggest why it is not showing it all on the ui?
            >
            > Thankx and regards
            > Vik
            >
            >


            • 3. Re: Switching array collection
              Level 7

              "vikceo" <webforumsuser@macromedia.com> wrote in message
              news:g9p9g4$o8h$1@forums.macromedia.com...
              > ok so with the help of Amy.. and hard work on my side.. the issue is.. it
              > things are switching perfectly but the component was not able to refresh.
              >
              > Actually, i have created a custom component which takes this
              > arraycollection
              > rows as parameter. to make it work after changing the arraycollection and
              > refresh I need to manually call the invalidateProperties() method of my
              > custom
              > component.
              >
              > But, this is kinds of not a real good thing..I should not need to call..

              What's the code of your component?