I'm fairly certain Alex has blogged a custom Collection that does exactly
what you want (lets you view other collections together as one, so you
simply sort the individual collections)...

-Josh

On Tue, Nov 11, 2008 at 11:36 PM, Mark <[EMAIL PROTECTED]> wrote:

> Perfect, that did the trick... thanks
>
> -M
>
>
>
>
> --- In flexcoders@yahoogroups.com, "Tim Hoff" <[EMAIL PROTECTED]> wrote:
> >
> >
> > Yes, that wording does make a difference.  You can look into using
> a
> > sortCompare function.  Or, you can hack it by adding the item to
> the
> > collection, but in addition add an additional property to all of
> the
> > items in the collection, like sortIndex; that will be used to sort
> the
> > reset item at the top and then the regular items.  Assign 0
> to "Select
> > All' and 1 to all of the regular items.  Then add another sort
> field to
> > the collecton's sort so it sorts the sortIndex first and then the
> title:
> >
> > var sort:Sort = new Sort();
> > sort.fields = [];
> > sort.fields.push(new SortField("sortIndex", true, false, true));
> > sort.fields.push(new SortField("title",true));
> > nameCollection.sort = sort;
> > nameCollection.refresh();
> > //
> > // add new item to the top
> > //
> > var sItem:Object = new Object;
> > sItem = {sortIndex:0, title:"Select One"};
> > nameCollection.addItemAt(sItem,0);
> >
> > // you'll have to change the other objects in the collection to
> have the
> > sortIndex property and set them all to 1.
> >
> > -TH
> >
> > --- In flexcoders@yahoogroups.com, "Mark" <markp.shopping_id@>
> wrote:
> > >
> > > Thanks, but as soon as you make a choice from the comboBox you
> can't
> > > select it again as a default. And maybe "Select One" is the wrong
> > > wording for what I'm doing here... "Select All" would be a better
> > > choice of words.
> > >
> > > --- In flexcoders@yahoogroups.com, "Tim Hoff" TimHoff@ wrote:
> > > >
> > > >
> > > > <mx:ComboBox prompt="Select One"/>
> > > >
> > > > -TH
> > > >
> > > > --- In flexcoders@yahoogroups.com, "Mark" <markp.shopping_id@>
> > > wrote:
> > > > >
> > > > > Thanks for the quick reply Ralf, but I have no idea how to do
> > > either
> > > > of what you
> > > > > suggested. Would you know of any examples you can point me
> to?
> > > > >
> > > > > Thanks,
> > > > > Mark
> > > > >
> > > > > --- In flexcoders@yahoogroups.com, "Ralf Bokelberg"
> > > ralf.bokelberg@
> > > > wrote:
> > > > > >
> > > > > > You can provide your own sort function, which sorts your
> > > special
> > > > entry
> > > > > > at the top.
> > > > > > Alternatively you can use the prompt propertyof the
> combobox.
> > > It is
> > > > > > shown if the selectedIndex is set to -1
> > > > > > Cheers,
> > > > > > Ralf.
> > > > > >
> > > > > > On Sat, Nov 8, 2008 at 3:07 PM, Mark markp.shopping_id@
> wrote:
> > > > > > > I'm trying to sort an arrayCollection that is the
> > > dataProvider for
> > > > a
> > > > > > > comboBox. But I also need to add an item to the top of
> the
> > > > > > > list "Select One". Everything I've tried always sorts
> that
> > > object
> > > > > > > as well. Is there a way to exclude something from a sort
> or
> > > am I
> > > > > > > just doing this completly wrong? Here's what I have?
> > > > > > >
> > > > > > > var sort:Sort = new Sort();
> > > > > > > sort.fields = [];
> > > > > > > sort.fields.push(new SortField("title",true));
> > > > > > > nameCollection.sort = sort;
> > > > > > > nameCollection.refresh();
> > > > > > > //
> > > > > > > // add new item to the top
> > > > > > > //
> > > > > > > var sItem:Object = new Object;
> > > > > > > sItem = {title:"Select One"};
> > > > > > > nameCollection.addItemAt(sItem,0);
> > > > > > > //nameCollection.refresh();
> > > > > > >
> > > > > > > Thank You,
> > > > > > > Mark
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location:
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>


-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

Like the cut of my jib? Check out my Flex blog!

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]
:: http://flex.joshmcdonald.info/
:: http://twitter.com/sophistifunk

Reply via email to