--- In flexcoders@yahoogroups.com, Tom McNeer <tmcn...@...> wrote:
>
> I have an Advanced DataGrid that uses a Grouping Collection created from
> flattened data in an array collection. The hierarchy is only two levels
> deep: the grouping level and a detail level.
> 
> At the grouping level, I want to display a grouping label, plus information
> in four of the other eight columns. Two of the columns are summary items.
> 
> The grouping label function returns correct values, as do the summary
> columns.
> 
> The final two columns are populated by RendererProviders set to display at a
> depth of 1. One displays the Provider of a service. The other displays a
> Status. Both renderers are very simple and virtually identical:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Box xmlns:mx="http://www.adobe.com/2006/mxml";>
>     <mx:Label text="{data.children[0].Provider}" />
> </mx:Box>
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Box xmlns:mx="http://www.adobe.com/2006/mxml";>
>     <mx:Label text="{data.children[0].ProcedureStatus}" />
> </mx:Box>
> 
> Each pulls a value from the first child in the data object's array. Since
> the values for each child are identical for these pieces of data, grabbing
> them from the first child works.
> 
> Here's the odd part: let's say the first grouping has the following values:
> GroupingLabel: "Some string here."
> Children:
>    Provider: MyProvider1
>    Status: Approved
>    Description: Some different value
> 
>    Provider: MyProvider1
>    Status: Approved
>    Description: Some other value
> 
> And the second grouping has the following values:
> GroupingLabel: "Another string"
> Children:
>     Provider: MyProvider 2
>     Status: Pending
>     Description: Something else altogether
> 
> The grouping label displays correctly when the underlying array collection
> is populated, as do the Provider and Status, all in the grouping row.
> 
> However, when the first row is opened to show its children, the Status
> display changed to "Pending" -- but the Provider display remains correct.
> 
> And other elements bound to the value of Provider detect the change (for
> example, to display an "Edit" button). Yet -- if I add the value of Status
> into the function that builds the GroupingLabel, the original, correct value
> is displayed there.
> 
> Does anyone have any clue as to what's causing a change in the collection's
> data?

Put a break point into a handler for the event when the row is opened, then 
look in the variables window to see if the data has actually changed.  If it 
has, then you'll need to work backward from there to see how and why.

My suspicion is that the data hasn't changed, but instead that for some reason 
the renderer you see when you open the row is one that has previously been used 
for another item.  Since the data binding can't refresh on 
{data.children[0].ProcedureStatus} (if you're using Flex Builder, you should 
have seen a warning on this), you're seeing the value that was populated when 
the renderer was used before.

Try using children.getItemAt(0) instead.

HTH;

Amy

Reply via email to