The setItemAt() method will replace the item at the specified index, 
if there is one; addItemAt() adds a new item.  Make sure setItemAt() 
is what you really want by verifying the contents of your combobox.

Last time I checked, the prompt item was selectable just like any 
other item, and much easier to declare.

--- In [email protected], "yaagcur" <[EMAIL PROTECTED]> wrote:
>
> Thanks guys
> I think that what I actually needed is
> 
> teams.setItemAt({FRANCHNAME:'All Teams',FRANCHID:'All'},0);
> 
> This sets the extra row in the correct place and displays it as the
> default. I believe prompt would not be a selectable item  and 
would be
> more appropriate if a 'Please Select a team' was needed
> 
> --- In [email protected], "Doug Lowder" <douglowder@> 
wrote:
> >
> > The addItemAt() function takes an object as the first parameter, 
not 
> > an array of objects.  So you'd want:
> > 
> >  teams.addItemAt( {FRANCHNAME:'All Teams',FRANCHID:'All'} , 0); 
> > 
> > As Oscar states, there's a prompt property of ComboBox you can 
use 
> > to add that extra row.
> > 
> > --- In [email protected], "yaagcur" <agcur@> wrote:
> > >
> > > I return a recordset and create a new arraycollection just fine
> > > but wish to add an extra row at the top . The following just 
> > produces an
> > > [object, Object] result in the combo box I populate for the 
> > additional
> > > entry
> > > 
> > > 
> > > public function myFunction(event:ResultEvent):void {
> > >           trace ("results returned");
> > >           teams = new
> > > ArrayCollection(mx.utils.ArrayUtil.toArray
(event.result.source)); 
> > >           teams.addItemAt([{FRANCHNAME:'All 
> > Teams',FRANCHID:'All'}],0); //
> > > FRANCHNAME and FRANCHID are the two properties in the object
> > >   teams.refresh();
> > >   }       
> > > I would also like the combobox to show the new All teams as 
default
> > > in the combobox
> > > 
> > > cheers
> > >
> >
>







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