Matt,
Thanks so much for the suggestion-- that seems to work, though the
code isn't quite as succinct as I was hoping. Instead of being able to
call a method [viewHelper.setSelectedItem(event,
event.target.getRepeaterItem().sample_status)] from the
creationComplete that sets
event.target.selectedItem = def;
I had to call a method that did the following:
for (var i:Number = 0; i <
event.target.__dataProvider.mRecordsAvailable; i++) {
if (event.target.__dataProvider._items[i].label == def) {
event.target.selectedItem = event.target.__dataProvider._items[i];
}
}
Since a ComboBox's selectedItem must be a part of its dataProvider
(which makes sense). It works well, though, so I'm satisfied. :)
Thanks again,
YJ
--- In [email protected], "Matt Chotin" <[EMAIL PROTECTED]> wrote:
>
> Can you try assigning the selectedItem in the creationComplete handler
> of the ComboBox (event.target.selectedItem = ...)? Maybe we need to
> ensure that the dataProvider is set before the selectedItem.
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of fowleryj
> Sent: Friday, February 17, 2006 6:02 AM
> To: [email protected]
> Subject: [flexcoders] ComboBox in a Repeater
>
> Hi all,
>
> Has anyone here used a ComboBox within a Repeater? I'm successfully
> populating the ComboBoxes in my Repeater; but each ComboBox, while
> populated from the same dataProvider, will have a different default
> (selectedItem), and I haven't yet figured out how to accomplish that.
>
> The following does not work:
> <mx:ComboBox id="statusComboBox"
> dataProvider="{viewHelper.statusComboBoxData}"
> selectedItem="{repeater.currentItem.sample_status}"/>
>
> However when I put a Button next to each ComboBox for debugging
> purposes, the pop-up displays the correct information:
> <mx:Button
> click="mx.controls.Alert.show(event.target.getRepeaterItem().sample_stat
> us);"/>
>
> If anyone has dealt with this and can offer a suggestion, I'd greatly
> appreciate it.
>
> Thanks,
> YJ
>
>
>
>
>
> --
> 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
>
--
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/