Ar you sure prompt does not work with mxModel?  In the example below,
there is a prompt on both a staticly defined array and on one populated
from a call to HTTPService, and both work.

If you can't get this to work, use a handler function on the Result
event, and use addItemAt() to add an initial value.

Tracy

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
initialize="initApp()">
        <mx:Script>
                public  var aDP:Array = [ {label:"A", data:0},
{label:"B", data:1}, {label:"C", data:2}];
                public  var aDP2:Array;
                private function initApp():Void
                {
                        dsListData.send();
                        //cb2.setStyle("backgroundDisabledColor",
"0xFFFF00");  //does not work
                }
                private function onResult(oEvent:Object):Void
                {
                        aDP2 = oEvent.result.list.item; 
                }
        </mx:Script>
        <mx:HTTPService id="dsListData"
url="http://localhost:8700/flex/Samples/_ListData.xml";
result="onResult(event)" />
        <mx:ComboBox dataProvider="{aDP}" width="150" prompt="test" />
        <mx:ComboBox id="cb2" dataProvider="{aDP2}" width="150"
prompt="test2" 
                        backgroundDisabledColor="0xFFFF00" 
                        disabledColor="#339900"/>
</mx:Application>

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of dave7273
Sent: Monday, January 23, 2006 10:01 AM
To: [email protected]
Subject: [flexcoders] Adding First Element within ComboBox Control

I am trying to do a search screen that includes a comboBox control.  I 
want to query the database to retrieve the valid values the user can 
select, but also want to include a default value of "All Widgets" at 
the beginning of the comboBox.  I am able to use the prompt property 
to have my first value added, but only if I have a literal list that I 
have defined (i.e. not using a model).  Any ideas of the best way of 
doing this?

<script stuff>
var  first_widget = [{label:"All Widgets", data:""}];
</script stuff>
         <mx:Model id="WidgetModel">
                {Widget.getWidgets.result}
        </mx:Model>

<mx:ComboBox id="cboWidgets" dataProvider="{WidgetModel}" height="22" 
prompt="{first_role}"/>

Thanks!






--
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/
 


Reply via email to