RE: [flexcoders] Refreshing graphics in a tree
How are you updateing the dataProvider? If you use the correct API, the changes should reflect automatically. If you are using lower level assignments, then you might need to call itemUpdated for collections. What is your dataprovider? Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ben gomez farrell Sent: Friday, October 17, 2008 12:40 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Refreshing graphics in a tree Hey, I have a tree with a itemRenderer to have a clickable checkbox in it. I need to set the checkbox state sometimes through code. Everything works great, except the graphics of the checkbox don't update when it's set through code (mousing over the node will refresh the graphics) Is there a way to refresh the graphics of all the nodes through some method of the tree? I CAN open and close the nodes to refresh the graphics, but it seems really silly, and I have to track whats open and closed and make sure it gets back to the same state again. Thanks! ben
Re: [flexcoders] Refreshing graphics in a tree
My data is an ArrayCollection is set via mytree.dataProvider = myArrayCollection; I have a list as well, and when I do mylist.dataProvider.refresh(), the checkboxes on those update just fine. Unfortunately doing mytree.dataProvider.refresh() doesn't work - and only mousing over will update the graphics of the item. I'll look into itemUpdated though, and see how I can use it, thanks! ben Tracy Spratt wrote: How are you updateing the dataProvider? If you use the correct API, the changes should reflect automatically. If you are using lower level assignments, then you might need to call itemUpdated for collections. What is your dataprovider? Tracy *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *ben gomez farrell *Sent:* Friday, October 17, 2008 12:40 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Refreshing graphics in a tree Hey, I have a tree with a itemRenderer to have a clickable checkbox in it. I need to set the checkbox state sometimes through code. Everything works great, except the graphics of the checkbox don't update when it's set through code (mousing over the node will refresh the graphics) Is there a way to refresh the graphics of all the nodes through some method of the tree? I CAN open and close the nodes to refresh the graphics, but it seems really silly, and I have to track whats open and closed and make sure it gets back to the same state again. Thanks! ben
RE: [flexcoders] Refreshing graphics in a tree
So how are you updating the dataProvider items with the checkbox state? Are you using the ArrayCollection API? If so, then the UI will update automatically. Note: refresh() applies a sort. It does not generically refesh the UI. Also, if you use the API, it should not be necessary to do anything else for the list either. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ben gomez farrell Sent: Friday, October 17, 2008 1:36 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Refreshing graphics in a tree My data is an ArrayCollection is set via mytree.dataProvider = myArrayCollection; I have a list as well, and when I do mylist.dataProvider.refresh(), the checkboxes on those update just fine. Unfortunately doing mytree.dataProvider.refresh() doesn't work - and only mousing over will update the graphics of the item. I'll look into itemUpdated though, and see how I can use it, thanks! ben Tracy Spratt wrote: How are you updateing the dataProvider? If you use the correct API, the changes should reflect automatically. If you are using lower level assignments, then you might need to call itemUpdated for collections. What is your dataprovider? Tracy -- *From:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] *On Behalf Of *ben gomez farrell *Sent:* Friday, October 17, 2008 12:40 PM *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com *Subject:* [flexcoders] Refreshing graphics in a tree Hey, I have a tree with a itemRenderer to have a clickable checkbox in it. I need to set the checkbox state sometimes through code. Everything works great, except the graphics of the checkbox don't update when it's set through code (mousing over the node will refresh the graphics) Is there a way to refresh the graphics of all the nodes through some method of the tree? I CAN open and close the nodes to refresh the graphics, but it seems really silly, and I have to track whats open and closed and make sure it gets back to the same state again. Thanks! ben
Re: [flexcoders] Refreshing graphics in a tree
I have an arraycollection called groupsdata groupsdata.getItemAt(f).state = true/false And then in my itemRenderer, I override like this: override public function set data(value:Object):void { super.data = value; if ( !value ) { return; } // remove check box from child nodes if present if ( !value.toplevel this.getChildByName(checkbox) ) { this.removeChild( this.getChildByName(checkbox) ); } } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); if(super.data) { if (super.icon != null) { checkBox.x = super.icon.x; checkBox.y = 12; super.icon.x = checkBox.x + checkBox.width + 17; super.label.x = super.icon.x + super.icon.width + 3; checkBox.selected = super.data.state; } else { checkBox.x = super.label.x; checkBox.y = 12; super.label.x = checkBox.x + checkBox.width + 17; checkBox.selected = super.data.state; } } } So it looks like the data object is getting set correctly, but updateDisplayList isn't getting called when the data is refreshed - but it does get called on mouse over. thanks again for the help! ben Tracy Spratt wrote: So how are you updating the dataProvider items with the checkbox state? Are you using the ArrayCollection API? If so, then the UI will update automatically. Note: refresh() applies a sort. It does not generically “refesh” the UI. Also, if you use the API, it should not be necessary to do anything else for the list either. Tracy *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *ben gomez farrell *Sent:* Friday, October 17, 2008 1:36 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Refreshing graphics in a tree My data is an ArrayCollection is set via mytree.dataProvider = myArrayCollection; I have a list as well, and when I do mylist.dataProvider.refresh(), the checkboxes on those update just fine. Unfortunately doing mytree.dataProvider.refresh() doesn't work - and only mousing over will update the graphics of the item. I'll look into itemUpdated though, and see how I can use it, thanks! ben Tracy Spratt wrote: How are you updateing the dataProvider? If you use the correct API, the changes should reflect automatically. If you are using lower level assignments, then you might need to call itemUpdated for collections. What is your dataprovider? Tracy -- *From:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com] *On Behalf Of *ben gomez farrell *Sent:* Friday, October 17, 2008 12:40 PM *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com *Subject:* [flexcoders] Refreshing graphics in a tree Hey, I have a tree with a itemRenderer to have a clickable checkbox in it. I need to set the checkbox state sometimes through code. Everything works great, except the graphics of the checkbox don't update when it's set through code (mousing over the node will refresh the graphics) Is there a way to refresh the graphics of all the nodes through some method of the tree? I CAN open and close the nodes to refresh the graphics, but it seems really silly, and I have to track whats open and closed and make sure it gets back to the same state again. Thanks! ben -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] Refreshing graphics in a tree
Yes, this: groupsdata.getItemAt(f).state = true/false is a low-level assignment directly to the dataprovider item and does not dispatch the events necessary for the update of the UI. You can change it to use setItemAt() or you can call itemUpdated(item) after the assignment. I am sure both of these use the invalidation mechanism and optimize the rendering. I am not sure about refresh(), and that is not the correct usage anyway. Tracy -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ben gomez farrell Sent: Friday, October 17, 2008 2:01 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Refreshing graphics in a tree I have an arraycollection called groupsdata groupsdata.getItemAt(f).state = true/false And then in my itemRenderer, I override like this: override public function set data(value:Object):void { super.data = value; if ( !value ) { return; } // remove check box from child nodes if present if ( !value.toplevel this.getChildByName(checkbox) ) { this.removeChild( this.getChildByName(checkbox) ); } } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); if(super.data) { if (super.icon != null) { checkBox.x = super.icon.x; checkBox.y = 12; super.icon.x = checkBox.x + checkBox.width + 17; super.label.x = super.icon.x + super.icon.width + 3; checkBox.selected = super.data.state; } else { checkBox.x = super.label.x; checkBox.y = 12; super.label.x = checkBox.x + checkBox.width + 17; checkBox.selected = super.data.state; } } } So it looks like the data object is getting set correctly, but updateDisplayList isn't getting called when the data is refreshed - but it does get called on mouse over. thanks again for the help! ben Tracy Spratt wrote: So how are you updating the dataProvider items with the checkbox state? Are you using the ArrayCollection API? If so, then the UI will update automatically. Note: refresh() applies a sort. It does not generically refesh the UI. Also, if you use the API, it should not be necessary to do anything else for the list either. Tracy *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *ben gomez farrell *Sent:* Friday, October 17, 2008 1:36 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Refreshing graphics in a tree My data is an ArrayCollection is set via mytree.dataProvider = myArrayCollection; I have a list as well, and when I do mylist.dataProvider.refresh(), the checkboxes on those update just fine. Unfortunately doing mytree.dataProvider.refresh() doesn't work - and only mousing over will update the graphics of the item. I'll look into itemUpdated though, and see how I can use it, thanks! ben Tracy Spratt wrote: How are you updateing the dataProvider? If you use the correct API, the changes should reflect automatically. If you are using lower level assignments, then you might need to call itemUpdated for collections. What is your dataprovider? Tracy -- *From:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com] *On Behalf Of *ben gomez farrell *Sent:* Friday, October 17, 2008 12:40 PM *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com *Subject:* [flexcoders] Refreshing graphics in a tree Hey, I have a tree with a itemRenderer to have a clickable checkbox in it. I need to set the checkbox state sometimes through code. Everything works great, except the graphics of the checkbox don't update when it's set through code (mousing over the node will refresh the graphics) Is there a way to refresh the graphics of all the nodes through some method of the tree? I CAN open and close the nodes to refresh the graphics, but it seems really silly, and I have to track whats open and closed and make sure it gets back to the same state again. Thanks! ben -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf- 1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
Re: [flexcoders] Refreshing graphics in a tree
Thanks! You rock. I'd never used setItemAt on an ArrayCollection because its more verbose to pull the copy the item out and set the property you need, then pass it back in - so it never occured to me that you had to do that. Again, thanks, and i'll put the same fix on my list component. ben Tracy Spratt wrote: Yes, this: groupsdata.getItemAt(f).state = true/false is a low-level assignment directly to the dataprovider item and does not dispatch the events necessary for the update of the UI. You can change it to use setItemAt() or you can call itemUpdated(item) after the assignment. I am sure both of these use the invalidation mechanism and optimize the rendering. I am not sure about refresh(), and that is not the correct usage anyway. Tracy -Original Message- From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com] On Behalf Of ben gomez farrell Sent: Friday, October 17, 2008 2:01 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: Re: [flexcoders] Refreshing graphics in a tree I have an arraycollection called groupsdata groupsdata.getItemAt(f).state = true/false And then in my itemRenderer, I override like this: override public function set data(value:Object):void { super.data = value; if ( !value ) { return; } // remove check box from child nodes if present if ( !value.toplevel this.getChildByName(checkbox) ) { this.removeChild( this.getChildByName(checkbox) ); } } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); if(super.data) { if (super.icon != null) { checkBox.x = super.icon.x; checkBox.y = 12; super.icon.x = checkBox.x + checkBox.width + 17; super.label.x = super.icon.x + super.icon.width + 3; checkBox.selected = super.data.state; } else { checkBox.x = super.label.x; checkBox.y = 12; super.label.x = checkBox.x + checkBox.width + 17; checkBox.selected = super.data.state; } } } So it looks like the data object is getting set correctly, but updateDisplayList isn't getting called when the data is refreshed - but it does get called on mouse over. thanks again for the help! ben Tracy Spratt wrote: So how are you updating the dataProvider items with the checkbox state? Are you using the ArrayCollection API? If so, then the UI will update automatically. Note: refresh() applies a sort. It does not generically refesh the UI. Also, if you use the API, it should not be necessary to do anything else for the list either. Tracy -- *From:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com] *On Behalf Of *ben gomez farrell *Sent:* Friday, October 17, 2008 1:36 PM *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com *Subject:* Re: [flexcoders] Refreshing graphics in a tree My data is an ArrayCollection is set via mytree.dataProvider = myArrayCollection; I have a list as well, and when I do mylist.dataProvider.refresh(), the checkboxes on those update just fine. Unfortunately doing mytree.dataProvider.refresh() doesn't work - and only mousing over will update the graphics of the item. I'll look into itemUpdated though, and see how I can use it, thanks! ben Tracy Spratt wrote: How are you updateing the dataProvider? If you use the correct API, the changes should reflect automatically. If you are using lower level assignments, then you might need to call itemUpdated for collections. What is your dataprovider? Tracy -- *From:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com] *On Behalf Of *ben gomez farrell *Sent:* Friday, October 17, 2008 12:40 PM *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com *Subject:* [flexcoders] Refreshing graphics in a tree Hey, I have a tree with a itemRenderer to have a clickable checkbox in it. I need to set the checkbox state sometimes through code. Everything works great, except the graphics of the checkbox don't update when it's set through code (mousing over the node will refresh the graphics) Is there a way to refresh the graphics of all the nodes through some method of the tree? I CAN open and close the nodes to refresh the graphics, but it seems really silly, and I have to track whats open and closed and make sure it gets back to the same state again. Thanks! ben