You might try myCursor.findFirst({title:"b"});  It looks like if the 
underlying array isn't simple and you perform a field sort, you must 
look for that field with findFirst.  If this doesn't work, you can 
always abandon the cursor approach and simply use the built in 
methods of the ArrayCollection.  Although for a search, looping 
instead of using findFirst isn't quite as elegant.

-TH

--- In flexcoders@yahoogroups.com, "matmls" <[EMAIL PROTECTED]> wrote:
>
> Thanks Tim.  I implemented your code which compiles just fine. 
> However, when I try to go to the next step by creating a cursor 
then 
> trying to do a findfirst, I get the error:
> 
> "Find criteria must contain at least one sort field value."  
> 
> Here is the code now:
> 
> 
> #########################################################
> 
> private var myCursor:IViewCursor;
> var masterListSort:Sort = new Sort();
> var titleSortField : SortField = new SortField("title", true, 
false, 
> false);
> masterListSort.fields = [titleSortField];
> masterList.dataProvider.sort=masterListSort;
> masterList.dataProvider.refresh();
> myCursor= masterList.dataProvider.createCursor();
> myCursor.findFirst("b");
> 
> ##############################################
> 
> Am I missing something in the implementation of IViewCursor?
> 
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "Tim Hoff" <Tim.Hoff@> wrote:
> >
> > Hi,
> > 
> > This should do the trick:
> > 
> > var masterListSort:Sort = new Sort();
> > var titleSortField : SortField = new SortField("title", true, 
> false, 
> > false);
> > masterListSort.fields = [titleSortField];
> > masterList.dataProvider.sort=masterListSort;
> > masterList.dataProvider.refresh();
> > 
> > -TH
> > Cynergy Systems
> > 
> > --- In flexcoders@yahoogroups.com, "matmls" <matmls@> wrote:
> > >
> > > I have a Remote Object that returns data from a cfc. I use the 
> > > results to populate a datagrid. 
> > > 
> > > #######
> > > this.masterList.dataProvider = event.result as ArrayCollection;
> > > #######
> > > 
> > > I apply a cursor to the grid.
> > > 
> > > ####
> > > myCursor=masterList.dataProvider.createCursor();
> > > ####
> > > 
> > > The problem is that when I try to apply a sort, the column in 
the 
> > > grid that I want to use comes from the label property of a 
> > Linkbutton 
> > > which is nested inside of an itemRenderer.
> > > 
> > > #######
> > > <mx:DataGridColumn  textAlign="left" headerText="Resource" 
> > > wordWrap="true" width="300" >
> > > <mx:itemRenderer>
> > > <mx:Component>
> > > <mx:LinkButton rollOverColor="#ffff66" 
textDecoration="underline" 
> > > label="{data.title}" click="{navigateToURL(new URLRequest
> > > (data.url));}" >
> > > </mx:LinkButton>
> > > </mx:Component>
> > > </mx:itemRenderer>        
> > > </mx:DataGridColumn >
> > > #######
> > > 
> > > I'm not sure how to access the column data that I want to use 
> with 
> > > SortField.
> > > 
> > > ######
> > > var sort:Sort = new Sort();
> > > sort.fields=[new SortField("?")];
> > > masterList.dataProvider.sort=sort;
> > > masterList.dataProvider.refresh();
> > > ######
> > > 
> > > Any ideas would be appreciated.
> > >
> >
>


Reply via email to