4 Replies Latest reply on Mar 18, 2008 9:36 AM by Arun_Bangalore

    VScroll Bar and Tree Issue

    Arty13 Level 1
      I have a tree component and am using a custom DataDescriptor, when I dynamically add data to the DataProvider, I have a set that does not show in the tree. When those items get added, the VScrollBar will show. But since the items are 'hidden' and do not show in the tree view, the VScrollBar should not be showing. If I expand an item in the tree, then the VScrollBar will disappear and the tree will look like it is supposed to be.

      I tried using (individually and in combination) invalidateSize(), invalidateDisplayList(), invalidateProperties(), and invalidateList() on the tree but it doesnt update the VScrollBar like it should.

      Any help would be greatly appreciated, thanks.

      Art
        • 1. Re: VScroll Bar and Tree Issue
          Arty13 Level 1
          Any ideas?
          • 2. Re: VScroll Bar and Tree Issue
            Arun_Bangalore
            Arty
            Any luck i'm stuck up with same issue. Did you fix up it up
            • 3. Re: VScroll Bar and Tree Issue
              Arty13 Level 1
              Actually I did find a solution to my issue and why it is showing the the VScroll Bar.

              In the DataDescriptor when my hidden items are getting added to the collection, i am dispatching an event on the model (the event is the collection event of kind add) and when the collection got this event it would update it's "size" and then the tree would think its display was larger than it really was and hence the VScroll bar. So i removed my dispatch event so the collection would not update it's "size"

              This fixed my issue, and hopefully this helps you out some Arun.

              Art
              • 4. Re: VScroll Bar and Tree Issue
                Arun_Bangalore Level 1
                Arty,
                My issue is i'm not getting Vscrollbar on dynamic loading(lazy loading). I'm using flex 3 with cairngorm framework. Loading all children(dynamically) in getchildren method of datadescriptor. Here is my descriptors file

                package com.primavera.flex.admin.calendar.ui
                {
                import com.adobe.cairngorm.control.CairngormEventDispatcher;
                import com.primavera.flex.admin.calendar.events.GetProjectEvent;
                import com.primavera.flex.admin.calendar.vo.ProjwbsVO;

                import mx.collections.ArrayCollection;
                import mx.collections.ICollectionView;
                import mx.controls.treeClasses.DefaultDataDescriptor;
                import mx.events.CollectionEvent;
                import mx.events.CollectionEventKind;

                public class PickListTreeDescriptor extends DefaultDataDescriptor
                {
                public function PickListTreeDescriptor()
                {
                super();
                }


                override public function getData(node:Object, model:Object=null):Object
                {
                return node;
                }

                override public function hasChildren(node:Object, model:Object=null):Boolean
                {

                return ProjwbsVO(node).isEPS();
                }

                override public function isBranch(node:Object, model:Object=null):Boolean
                {

                return ProjwbsVO(node).isEPS();


                //return false;
                }

                override public function getChildren(node:Object, model:Object=null):ICollectionView
                {
                var epsVO : ProjwbsVO = ProjwbsVO(node);
                if (epsVO.isEPS())
                {
                // this check for delay loading once the data is loaded it should not make a remote call again
                if(epsVO.isProjectsLoaded == false)
                {
                epsVO.isProjectsLoaded = true;
                var projectEvent : GetProjectEvent = new GetProjectEvent(null);
                projectEvent.projwbsVO = epsVO;
                CairngormEventDispatcher.getInstance().dispatchEvent(projectEvent);
                var collection:ICollectionView = ICollectionView(model);
                var event:CollectionEvent = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
                event.kind = CollectionEventKind.ADD;
                event.items = ArrayCollection(epsVO.children).toArray();
                collection.dispatchEvent(new CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
                }
                }

                return epsVO.children;
                }



                }
                }


                Projwbs is my object in Arraycollection. Hierachy is like EPS can have projects(leafnode) and child Eps(branch node). EPS is determined if projwbs.isEps returns true.

                On UI it gives a single root node in a collapsed state. When i expand it furthur it gives child EPS and projects in it. On expanding root node i get childrens but in screen Vscrollbar is not visible.

                Please let me know if you have any thougts on this.