You are quite right. setItemAt does knock out a line

I should have mentioned that I am trying to construct a reusable
combobox component

Anyways this seems to do the trick

teams.addItemAt({FRANCHNAME:'All Teams',FRANCHID:'All'},0);
this.selectedIndex=0;

re. prompt. I believe they changed how it works during development so
that now it is just for info - but I may be wrong
I also found a relevant thread at feed-squirrel
http://www.feed-squirrel.com/blog/index.cfm/2006/6/15/Flex-2-Puzzle-No-2-The-Answers




--- In [email protected], "Doug Lowder" <[EMAIL PROTECTED]> wrote:
>
> 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" <agcur@> 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
> > > >
> > >
> >
>





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

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