Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 105619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:28:04+00:00 2026-05-11T01:28:04+00:00

I’ve a tree control with checkboxes that uses the control from http://www.sephiroth.it/file_detail.php?id=151# Somehow I

  • 0

I’ve a tree control with checkboxes that uses the control from http://www.sephiroth.it/file_detail.php?id=151#

Somehow I can’t get the control to update when I change the dataProvider (i.e. by clicking a checkbox) the only way I can get it to update is to use the scrollbar. How do I force the update? I’ve tried all possible methods I can figure out? (see update below)

Also how can I reset the Tree (collpasing all nodes, scroll to the top in a large tree)?

package offerta.monkeywrench.components {      import offerta.monkeywrench.components.componentClasses.TreeCheckBoxItemRenderer;      import mx.collections.ArrayCollection;      import mx.events.TreeEvent;      public class WatchTree extends TreeCheckBox     {          public var idProperty:String;          public var watchFactory:Function;          private var _wSet:Boolean = false;          /* clientId: */          private var _clientId:String;          [Bindable]         public function get clientId():String         {             return _clientId;         }          public function set clientId(value:String):void         {             this._clientId = value;         }          /* //clientId */          /* watching: */          private var _watching:ArrayCollection;          [Bindable]         public function set watching(value:ArrayCollection):void         {             this._watching = value;         }          public function get watching():ArrayCollection         {             return this._watching;             }          /* //watching */          override public function initialize() :void         {             super.initialize();             addEventListener('itemCheck', onItemCheck, false, 0, true);         }          private function isWatching(id:String):Boolean         {             for each(var w:Object in this._watching)             {                 if(w[this.idProperty]==id) return true;             }             return false;         }          private function onItemCheck(event:TreeEvent):void         {             var item:Object = event.item as Object;             var currentValue:uint = (event.itemRenderer as TreeCheckBoxItemRenderer).checkBox.checkState;             if(item.children==null)             {                 currentValue==2 ? addWatch(item.Id) : removeWatch(item.Id);             }             else             {                 for each(var x:Object in item.children)                 {                     currentValue==2 ? addWatch(x.Id) : removeWatch(x.Id);                 }             }             updateParents(item, currentValue);             updateChilds(item, currentValue);             this.dataProvider.refresh();             super.invalidateProperties();             super.invalidateDisplayList();             super.updateDisplayList(this.unscaledWidth, this.unscaledHeight);         }          private function updateParents(item:Object, value:uint):void         {             var checkValue:String = (value == ( 1 << 1 | 2 << 1 ) ? '2' : value == ( 1 << 1 ) ? '1' : '0');             var parentNode:Object = item.parent;             if(parentNode)             {                 for each(var x:Object in parentNode.children)                 {                     if(x.checked != checkValue)                     {                         checkValue = '2'                     }                 }                 parentNode.checked = checkValue;                 updateParents(parentNode, value);             }         }          private function updateChilds(item:Object, value:uint):void         {             var middle:Boolean = (value&2<<1)==(2<<1);              if(item.children!=null && item.children.length>0&&!middle)             {                 for each(var x:Object in item.children)                 {                     x.checked = value == (1<<1|2<<1) ? '2' : value==(1<<1) ? '1' : '0';                     updateChilds(x, value);                 }             }         }          private function addWatch(id:String):void         {             if(isWatching(id)) return;             this._watching.addItem(this.watchFactory(id, this.clientId));         }          private function removeWatch(id:String):void         {             for(var i:int=0, n:int=this._watching.length; i<n; ++i)             {                 if(this._watching[i][this.idProperty]==id)                 {                     this._watching.removeItemAt(i);                     return;                 }             }         }          public function update(__watching:ArrayCollection, __clientId:String):void         {             clientId = __clientId;             watching = __watching;             if(this.dataProvider!=null)             {                 var ws:ArrayCollection = ArrayCollection(this.dataProvider);                 for each(var group:Object in ws)                 {                     var count:int = 0;                     for each(var child:Object in group.children)                     {                         if(isWatching(child.Id))                         {                             child.checked = '1';                             count++;                         }                     }                     group.checked = (count==0 ? '0' : (count==group.children.length ? '1' : '2'));                 }                 this._wSet = false;                  var dp:ArrayCollection = ArrayCollection(this.dataProvider);                 dp.refresh();                 super.invalidateProperties();                 super.invalidateDisplayList();                 super.updateDisplayList(this.unscaledWidth, this.unscaledHeight);                  //scroll up the list???                  //collapse? (doesn't work)                 this.expandItem(null, false);             }         }      }         } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:28:04+00:00Added an answer on May 11, 2026 at 1:28 am

    I’ve found the Tree control a little touchy in Flex. The way I ended up forcing a redraw was to disconnect the dataProvider and reconnect it, then force validation, something a bit like this :

    private function forceRedraw(tree:Tree, dataProvider:Object):void {     var scrollPosition:Number = tree.verticalScrollPosition;     var openItems:Object = tree.openItems;     tree.dataProvider = dataProvider;     tree.openItems = openItems;     tree.validateNow();     tree.verticalScrollPosition = scrollPosition; }

    I guess this incidentally answers the second part of your question since all you’d have to do is null out the openItems collection and set the verticalScrollPosition to 0.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 101k
  • Answers 101k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think vim --version will do what you're looking for. May 11, 2026 at 8:02 pm
  • Editorial Team
    Editorial Team added an answer Depends if you just going to have just one bullet… May 11, 2026 at 8:02 pm
  • Editorial Team
    Editorial Team added an answer The recent versions of the plugin have the 'Nexus Indexer'… May 11, 2026 at 8:02 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.