If this type of question has been answered before, I appologize, but
the new Yahoo! Groups message search really sucks!
Anyway, I'm fairly new to Flex and am working on a project using the
Cairngorm framework. In the project I have a form that is bounded to
a sharedObject in order to save the user's responses in case they do
not complete the form in one sitting. When the user returns to the
form, I reload the fields with the values stored in the sharedObject.
All works fine with text fields and check boxes. The problem comes
with a couple drop-down fields. Basically, when the form is loaded I
call back to the CF server to retrieve a list of values to populate
the drop-down, and set an array variable in my ModelLocator, which is
bound as the data provider to the drop-down. The problem I have is
that I can't figure out how to set the selectedItem after the
drop-down is populated. I tried to create a function that accepted
the ModelLocator Array and set it then, but that does not seem to
work. Anyone else have any suggestions?
Thanks,
Sean
-------------------------------------------------------------------
View
-------------------------------------------------------------------
<mx:Panel xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns:GroupFormHelpers =
"com.hopeequity.view.form.helpers.*"
width="100%" height="100%" title="Group Manager
Information"
creationComplete="GroupFormStep1Helper.initalizeForm();" >
<mx:Script>
<![CDATA[
import com.hopeequity.model.ModelLocator;
import com.hopeequity.vo.CountryVO;
import com.hopeequity.vo.StateVO;
public var formModel:Object;
]]>
</mx:Script>
<GroupFormHelpers:Step1Helper id="GroupFormStep1Helper" />
...
<mx:ComboBox id="Country" editable="false"
dataProvider="{ModelLocator.countries.sortOn(['OUTPUTORDER'],16)}"
labelField="COUNTRYNAME" width="{FirstName.width}"/>
...
-------------------------------------------------------------------
View Helper
-------------------------------------------------------------------
...
public function initalizeForm()
{
EventBroadcaster.getInstance().broadcastEvent("getCountriesWithStates");
}
...
-------------------------------------------------------------------
Command File
-------------------------------------------------------------------
class com.hopeequity.command.GetCountriesWithStatesCMD implements
Command, Responder
{
public function GetCountriesWithStatesCMD()
{
}
public function execute( event : Event ):Void
{
if (ModelLocator.countries.length < 1)
{
var delegate : CountryDelegate = new CountryDelegate(
this );
delegate.getCountriesWithStates(event);
}
}
public function onResult( event : Object ) : Void
{
ModelLocator.countries = event.result;
}
public function onFault( event : Object ) : Void
{
mx.core.Application.alert( event.fault.faultstring );
}
}
-------------------------------------------------------------------
Model Locator
-------------------------------------------------------------------
...
public static function initialise() : Void
{
ModelLocator.countries = new Array();
}
public static var countries : Array;
------------------------ Yahoo! Groups Sponsor --------------------~-->
AIDS in India: A "lurking bomb." Click and help stop AIDS now.
http://us.click.yahoo.com/9QUssC/lzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/