Hi,
I have read posts in this group, as well as many blog entries, regarding the
frequent need to manually sort the items in an AdvancedDataGrid when the
underlying data changes. ((I'm using SDK 3.5.)
And I have instances of the ADG where I have, in fact, successfully created
and used a sort that fires when the underlying data provider changes.
But I've got one now that just doesn't want to work, and I think the problem
must lie somehow in the grouping that goes on after the data provider is
refreshed.
In short, here's the scenario. I have an ArrayCollection that represents a
flat data hierarchy. In each item of the AC, there is a ProcedureID. There
may be multiple Items for a Procedure, so you may typically have four or
five items in the AC with the same ProcedureID, but differing ItemIDs.
The GroupingCollection is set around the ProcedureID, and the idea is that
the sort should be on the ProcedureID descending.
Here's the sort function that fires on data change. The GroupingCollection
is "rc." The ADG is "requestGrid."
------------------------------------
public function refreshGrid(e:Event):void{
rc.refresh();
requestGrid.validateNow();
var sort:Sort = new Sort();
sort.fields = [new SortField("ProcedureID",false,true)];
IHierarchicalCollectionView(requestGrid.dataProvider).sort =
sort;
IHierarchicalCollectionView(requestGrid.dataProvider).refresh();
}
------------------------------------
When I step through this in the debugger, I can see that the sort is created
correctly, and that the data provider is sorted and refreshed. But then the
grid shows its contents in an apparently random order. The parent-child
items in the grid are grouped correctly, but the ordering is incorrect.
Can someone suggest how to troubleshoot this further, please?
--
Thanks,
Tom
Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560