How do you replace the dataProvider of an AdvancedDataGrid?

I'm reorganizing the data, and, for efficiency, I'd like to do so in 
an ArrayCollection that's not linked to the ADG, and then replace the 
dataProvider. I've had a lot of trouble getting this to work.

First I tried the obvious (the dataProvider's name is "d"):

var a:ArrayCollection = new ArrayCollection();
...
this.d = a;

The grid did not get updated visually, so I figured the class member 
and the actual dataProvider may be disconnected. So I tried:

this.dataProvider = a;

This time, the grid updated somewhat (the "somewhat" was probably do 
to unrelated bugs), but accessing the grid caused exceptions. For 
example, when I called isItemOpen(), an exception was thrown, saying 
that my dataprovider class couldn't be cast to 
IHeirarchicalCollectionView.

So I tried this.dataProvider.source, which caused the same exception, 
and then this.dataProvider.source.source, which brought me back to 
the original state, where the grid wasn't visually updated.


In all cases, I called d.refresh() and this.invalidateList() after 
making the changes.

Any ideas?

Reply via email to