Re: [flexcoders] Re: Getting parent information from AdvancedDataGrid
Amy, You can't put the same object in your dataProvider twice. This is an error for DataGrid and AdvancedDataGrid. They use the UID to create Object-based hashes for various purposes. If you put the same object in there twice, the grid won't function properly. Here are two articles, one for each grid, that explain this (although, I think you've figured this out, I thought I'd post anyway for others): AdvancedDataGrid highlights wrong row with duplicate data: http://jonathanbranam.net/solutions/advanceddatagrid-highlights-wrong-row http://tinyurl.com/5kzjge DataGrid highlights wrong row with duplicate data: http://jonathanbranam.net/solutions/datagrid-highlights-wrong-row http://tinyurl.com/55hzhu Also, the UIDUtil class will only add an mx_internal_uid property to your data if you are using dynamic classes (like Object, Array, or a custom dynamic class). If you're using a strongly typed VO or XML, the method of storing the UID is different. You can read about it in the UIDUtil article here: http://jonathanbranam.net/flex3anatomy/class/UIDUtil http://tinyurl.com/6crwey -Jonathan http://jonathanbranam.net - Flex 3 Anatomy Solutions On Sat, Jun 28, 2008 at 3:59 PM, Amy [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Sorry, this thread is one of the ones I am following for my own education. It is beyond my current experience. I found that my code wasn't adding the UID where I thought it was. When the HierarchicalCollection called the UIDUtil class, the UIDUtil class saw that my component was an IUID but had a null UID and set a UID on it. This suggests that it should have also been adding a mx_internal_uid to my old class that did not implement IUID, but I could never get at it. In retrospect, I'm not really sure how much good it would have done for it to do that, since it was always the _same_ instance that it would have been added to. Somewhere in the asdoc comments of one of the classes I stepped through to find this was a comment to the effect that two references to the identical object shouldn't have worked in the first place. So, in summary, I think that the HierarchicalCollection _can't_ handle this situation, because to do so it would have to make the same instance different, which is why I needed to do something to wrap the same instance in different instances of another class. Live and learn. At this rate my head will explode by mid July. -Amy -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
[flexcoders] Re: Getting parent information from AdvancedDataGrid
--- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Sorry, this thread is one of the ones I am following for my own education. It is beyond my current experience. I found that my code wasn't adding the UID where I thought it was. When the HierarchicalCollection called the UIDUtil class, the UIDUtil class saw that my component was an IUID but had a null UID and set a UID on it. This suggests that it should have also been adding a mx_internal_uid to my old class that did not implement IUID, but I could never get at it. In retrospect, I'm not really sure how much good it would have done for it to do that, since it was always the _same_ instance that it would have been added to. Somewhere in the asdoc comments of one of the classes I stepped through to find this was a comment to the effect that two references to the identical object shouldn't have worked in the first place. So, in summary, I think that the HierarchicalCollection _can't_ handle this situation, because to do so it would have to make the same instance different, which is why I needed to do something to wrap the same instance in different instances of another class. Live and learn. At this rate my head will explode by mid July. -Amy
[flexcoders] Re: Getting parent information from AdvancedDataGrid
--- In flexcoders@yahoogroups.com, Amy [EMAIL PROTECTED] wrote: Hi, all; I have been using AdvancedDataGrid to display information in a HierarchicalCollection. The parent (container) items contain information on how the child items should be viewed. So the same child might be in the tree three different types under different parents. I left the view information in the container, since it has nothing to do with the actual data contained in the child object. The problem I am having is that I don't seem to be able to find a way to get at that data from the parent data when a user clicks on a child. OK, I got the bright idea that I would composite the existing class with a new class that has a uid. The class looks like this: package com.magnoliamultimedia.vo { import mx.core.IUID; import mx.utils.UIDUtil; public class TaskUID implements IUID { private var _task:Task; private var _uid:String; public function TaskUID(task:Task) { _task=task; _uid:UIDUtil.createUID(); } public function get uid():String { return _uid; } public function set uid(value:String):void { throw new Error(Can't directly set UID); } public function get task():Task{ return _task; } } } The problem is that as soon as the ADG loads, I get a ton of Can't directly set UID errors. I thought Flex was _not supposed_ to set UID's on classes that implement IUID? Note that this is not a visual clas, these are typed objects in an ArrayCollection of typed objects that have ArrayCollections in them named children (HierarchicalCollection). If Flex is adding a UID to my objects, is there any way I can tease it out to use it to determine the parent? Thanks; Amy
RE: [flexcoders] Re: Getting parent information from AdvancedDataGrid
Amy, I have a request. Please consider placing your response above the history? You have good stuff to say, but always having to scroll through the history is aggravating, and provides no value. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Amy Sent: Friday, June 27, 2008 5:39 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Getting parent information from AdvancedDataGrid --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Amy [EMAIL PROTECTED] wrote: Hi, all; I have been using AdvancedDataGrid to display information in a HierarchicalCollection. The parent (container) items contain information on how the child items should be viewed. So the same child might be in the tree three different types under different parents. I left the view information in the container, since it has nothing to do with the actual data contained in the child object. The problem I am having is that I don't seem to be able to find a way to get at that data from the parent data when a user clicks on a child. OK, I got the bright idea that I would composite the existing class with a new class that has a uid. The class looks like this: package com.magnoliamultimedia.vo { import mx.core.IUID; import mx.utils.UIDUtil; public class TaskUID implements IUID { private var _task:Task; private var _uid:String; public function TaskUID(task:Task) { _task=task; _uid:UIDUtil.createUID(); } public function get uid():String { return _uid; } public function set uid(value:String):void { throw new Error(Can't directly set UID); } public function get task():Task{ return _task; } } } The problem is that as soon as the ADG loads, I get a ton of Can't directly set UID errors. I thought Flex was _not supposed_ to set UID's on classes that implement IUID? Note that this is not a visual clas, these are typed objects in an ArrayCollection of typed objects that have ArrayCollections in them named children (HierarchicalCollection). If Flex is adding a UID to my objects, is there any way I can tease it out to use it to determine the parent? Thanks; Amy
[flexcoders] Re: Getting parent information from AdvancedDataGrid
--- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Amy, I have a request. Please consider placing your response above the history? You have good stuff to say, but always having to scroll through the history is aggravating, and provides no value. Funny, I find top posting aggravating, as the answer is before the question, and then I have to scroll down to find out what it was about, then back up to reread what was said in light of the question. BTW, did you have any insight to my issue? ;-) Thanks; Amy
RE: [flexcoders] Re: Getting parent information from AdvancedDataGrid
That is the thing about a request, you can decline it. And request is all I can do since, as yet, we have no established posting protocols on this list. Though you might want to look at the predominant posting styles. Sorry, this thread is one of the ones I am following for my own education. It is beyond my current experience. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Amy Sent: Friday, June 27, 2008 6:20 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Getting parent information from AdvancedDataGrid --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tracy Spratt [EMAIL PROTECTED] wrote: Amy, I have a request. Please consider placing your response above the history? You have good stuff to say, but always having to scroll through the history is aggravating, and provides no value. Funny, I find top posting aggravating, as the answer is before the question, and then I have to scroll down to find out what it was about, then back up to reread what was said in light of the question. BTW, did you have any insight to my issue? ;-) Thanks; Amy