I think the error you are getting is because not all objects/nodes contain a 
date attribute.  Normally, the sort code checks the first item to see if it has 
the sortField.  That's probably why it works sometimes for you, depending on 
what the first node is.

When you use a custom compare function, the Sort code doesn't check to see 
whether the sortFIeld exists

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of sleblang
Sent: Friday, September 05, 2008 9:03 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Datagrid - Sort Error


Thanks. However, I looked at the code and it looks basically the same as mine 
with the only noticeable difference being the compare function. Is the compare 
function necessary if I am only sorting by one column (Date)?

Thanks.
--- In flexcoders@yahoogroups.com, "Igor Costa" <[EMAIL PROTECTED]> wrote:
>
> Try This.
> http://blog.flexexamples.com/2008/04/09/creating-a-custom-sort-on-a-datagrid-control-in-flex/
>
>
> It will help you.
>
>
> Regards
> Igor Costa
> www.igorcosta.org
>
>
> On Fri, Sep 5, 2008 at 7:53 PM, sleblang [EMAIL PROTECTED] wrote:
>
> > I am getting the following error when attempting to run a sort on a
> > datagrid's dataprovider (which is an XMLListCollection). It doesn't occur
> > the first time I r! un the sort, however all subsequent runs result in an
> > error:
> >
> > Error: Find criteria must contain at least one sort field value
> >
> > Here is the sort code:
> >
> > // sort on date
> > var sortA:Sort = new Sort();
> > var sortByDate:SortField = new SortField("@date",false,false)
> >
> > sortA.fields=[sortByDate];
> >
> > // Refresh the collection view to show the sort.
> > modelLocator.projectData.projectData_xlc.sort = sortA;
> > modelLocator.projectData.projectData_xlc.refresh();
> >
> > Any ideas as to where the error might be?
> >
> > Thanks for any and all replies.
> >
> >
> >
> >
> >
>
>
>
> --
> ----------------------------
> Igor Co! sta
> www.igorcosta.com
> www.igorcosta.! org
& gt;

Reply via email to