DataGrid dataProvider is not getting data reliably

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

DataGrid dataProvider is not getting data reliably

mark goldin
I have the following situation. A popup with a class based on vBox with
dataGrid in it.
Code in Popup looks like this:
<view:ProjectPointsAlarmManagement
dataProvider="{_modelLocator.eventSummary.selectedProjectPoints}"/>

Where ProjectPointsAlarmManagement is my vBox classs with the grid.
In that class I have the following function:
public function set dataProvider(value:Object):void
{
if (value)
{
grid.dataProvider = value;
}
}
where grid is the DataGrid that looks like this:
<view:ProjectPointDataGrid id="grid"/>

ProjectPointDataGrid  is the actual DataGird class with the following code
for dataProvider:
override public function set dataProvider(value:Object):void
{
if (value)
{
super.dataProvider = value;
                dataProviderChanged(); // will be running against empty
dataProvider
ArrayCollection(super.dataProvider).addEventListener(CollectionEvent.COLLECTION_CHANGE,
dataProviderChanged);
}
}
The reason I am listening to CollectionEvent event is because when
*value *becomes
non null the dataProvider still has no data and code
in dataProviderChanged function that I need to execute is not working
properly.

My solution is working, at most part. It takes some clicking to to realize
that sometimes it's not getting into dataProviderChanged function.

Any idea for code refactoring?

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: DataGrid dataProvider is not getting data reliably

Nemi
In your code if one is setting dataProver to null, there wont happen anything?
Maybe you are missing "else..." after "if (value)..."

Loading...