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" <[EMAIL PROTECTED]> 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