hi All

I am working on combo box data provider
getting updated after call to a remote object which
returns an array.  I am trying to update the data provider
in a event handler for remote object. The problem is it sometimes gets
updated and sometimes not - I read that remote object events
are asynchronously handled. I am not exactly clear how -
if at all - it affects my scenario.

Here is my application init tag -
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" preinitialize="getCPData()" height="90%" width="70%"
backgroundColor="#FFFFFF" creationComplete="initApp();">

My combo box is defined like -

<mx:ComboBox width="100%" id="cpCombo" dataProvider="{cpCollection}"
labelField="name" change="onCpChange()" prompt="--Select--"/>

In getCPData() method during app preinitialization, I am creating
remote object to
get data from server side java component. For this remote object,
an event handler - cpEventHandler - is invoked.
cpEventHandler is updating data provider of the combo box -

cpCollection = event.result as ArrayCollection;

There are 2 scenarios - 1.in one, i dont need
to select any option in the combo box, so prompt="--Select--"
gives me 'Select' value default. 2. in 2nd, i need to set combo box
to some selected index.

In initApp method, which is called on app creationComplete, I am invoking
a javascript component which passes few parameters back to a flex method,
which tries to access data provider of the combo box. I suppose the combo
box data provider should have been set by the time initApp is called as it is
done in getCPData which is called on app preinitialize. But it happens
sometimes,
sometimes not which is frustrating.

Can somebody throw light on this.

Regards,
Nitin

Reply via email to