Does signalList have an extra element in it?

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of netdeep
Sent: Friday, July 11, 2008 11:46 AM
To: [email protected]
Subject: [flexcoders] Re: combobox fills in with blank element

 


Here is the relevant code from the component with the combobox:

[Bindable]
private var signalList:ArrayCollection = new ArrayCollection();

public function setSignals(sig:ArrayCollection):void {
signalList = sig;
}

<mx:ComboBox dataProvider="{signalList}" selectedIndex="0" 
toolTip="{signal.selectedItem.name}" change="selectSignal()"
color="#000000" id="signal" labelField="name"/>

And here is my Application actionscript code for populating signalList:

var arr:Array = archiveList.selectedItems;
for (var i:int=0; i<arr.length; i++) {
if (!signalList.contains(arr[i].name)) {
signalList.addItem(arr[i].name);
}
}
var sort:Sort = new Sort();

// Set the sort field (case-insensitive)
sort.fields = [new SortField(null,true)];
// Assign the Sort object to the view.
signalList.sort = sort;
// Apply the sort to the collection.
signalList.refresh();

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Show your code. Last time, someone was inadvertently putting a space
> into the CB's dataProvider
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of netdeep
> Sent: Friday, July 11, 2008 5:48 AM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] combobox fills in with blank element
> 
> 
> 
> I have an ArrayCollection which is the dataProvider for a combobox in
a
> custom component. 
> However the ArrayCollection is located in the application so I assign
it
> to the custom 
> component via actionscript in the component. 
> 
> When I call addItem on the ArrayCollection the items go into the
> combobox, however the 
> first element is always blank. How can I can get rid of this and get
the
> combobox to add only 
> the items I am adding to the ArrayCollection?
>

 

Reply via email to