coldchillin
asked on
Flex 3 - Adding an item to a databound combobox
I'm trying to add an item to a combobox that is databound. I'm trying to add a first element of "All", but am new to flex. I know how I would do this is ColdFusion, and .Net, but am not sure of the syntax.
A RemoteObject calls a CFC to return a query to populate the combobox, and I need to add a first item of "All" for the field PaymentType.
A RemoteObject calls a CFC to return a query to populate the combobox, and I need to add a first item of "All" for the field PaymentType.
<mx:ComboBox id="cb_PaymentMethod" dataProvider="{acPaymentMethods}" labelField="PaymentType"/>
ASKER
I get that above, but how does that fit in with the following framework?
<mx:ComboBox id="cb_PaymentMethod" dataProvider="{acPaymentMethods}" labelField>
[Bindable] public var acPaymentMethods:ArrayCollection;
public function getPaymentMethods():void {
RO.getPaymentMethods();
}
private function getPaymentMethods_result(event:ResultEvent):void {
acPaymentMethods = event.result as ArrayCollection;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you! I used a different method to solve the problem (appending the query on the CFC side), but I reallly wanted to know the answer!
itemAll.data = "All";
itemAll.label = "All";
acPaymentMethods.addItemAt
This will add "All" to the first position.