Hi,
I am aware of the need to refresh the GroupingCollection within an
AdvancedDataGrid in order to display the data from the dataprovider.
But I'm having trouble firing the refresh at the right time.
In my application, an event is fired when a navigation choice is made. The
event switches the view, causing instantiation of the component which
contains the ADG. The event also initiates a service call to retrieve data,
which is then injected into an ArrayCollection in the view component with
the ADG.
I realize that the instantiation of the view and ADG may (or may not) take
place before the data is returned. So I have done two things: in my ADG, I
have placed a "refresh" of the GroupingCollection in the "initialize" action
of the ADG (as recommended in the docs). I have also placed an eventListener
on the ArrayCollection which is the dataprovider, listening for a
COLLECTION_CHANGE event.
Here's some code:
=================
[Bindable]
public var acJobsInProgress:ArrayCollection = new
ArrayCollection;
private function init():void{
acJobsInProgress.addEventListener(CollectionEvent.COLLECTION_CHANGE,gridRefresh);
}
private function gridRefresh(e:Event):void{
divGrouping.refresh();
}
=================
The gridRefresh function executes when the ADG is initialized, but the
underlying AC is empty -- not unexpected.
But the function is never fired again. I've set further breakpoints, and I
can see that the AC is being correctly populated from the service. But the
GroupingCollection is not refreshed.
I would expect that the COLLECTION_CHANGE listener would fire when the AC is
populated from the service. But it doesn't seem to.
Can someone please help me understand where I'm going wrong?
--
Thanks,
Tom
Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560