You need to return retString; at the end of the function.

--- In [email protected], "jryano001" <[EMAIL PROTECTED]> wrote:
>
> Thanks for the response.  This is more than likely me being daft but 
> I've used the code you provided and set the labelFunction of 
> checkData on the status DataGridColumn and I get an error in Flex 
> stating:
> 
> 1170: Function does not return a value.
> 
> Is the checkData function checking both my customer and status 
> columns for '2' or do I have to (as I expect) enter in the column 
> name I want to check in the code you provided?
> 
> I appreciate your help and patience!
> 
> --- In [email protected], "Clint Tredway" <grumpee@> 
> wrote:
> >
> > use a labelFunction to check the value and then do something:
> > 
> > private function checkData(item:Object,column:Object):String{
> >     var retString:String;
> >     if(item['column'] == 2){
> >         retString="Return String";
> >      } else {
> >          retString = "Alt Return string";
> >      }
> > }
> > 
> > then set this as the labelFunction on that DataGridColumn and that 
> should
> > get you going.
> > 
> > On 2/12/07, jryano001 <jryan@> wrote:
> > >
> > >   Hi,
> > >
> > > I'm very new to Flex and hope someone advise me on this or tell 
> me if
> > > it's even possible!
> > >
> > > My Flex application is pulling data using a php page. The data is
> > > then parsed into XML and is placed inside an ArrayCollection 
> called
> > > custData. My DataGrid is then using custData as it's dataProvider.
> > > This is all working and my Datarid displays my two colmuns (cust &
> > > status).
> > >
> > > What I need to be able to do though is to check the values in my
> > > status column and if any of these change to '2' then trigger an 
> event
> > > (at the moment this could just be to display some text).
> > >
> > > I know (unless someone tells me otherwise) that I need an If
> > > statement to check the values of status in my ArrayCollection but 
> I
> > > need to know how you access just the values of status and if one 
> has
> > > changed to '2' then to display the text.
> > >
> > > I'd really appreciate if someone could point me in the right
> > > direction. Thanks in advance. If it makes anything clearer then my
> > > code is below.
> > >
> > > ----------------------------------------------------------
> > > ----
> > >
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > > initialize="custRequest.send()">
> > >
> > > <mx:Script>
> > > <![CDATA[
> > > import mx.collections.ArrayCollection;
> > > import mx.rpc.events.ResultEvent;
> > >
> > > [Bindable]
> > > private var custData:ArrayCollection;
> > >
> > > private function resultHandler
> > > (event:ResultEvent):void {
> > > custData = event.result.cstatus.customer;
> > > }
> > > ]]>
> > > </mx:Script>
> > >
> > > <mx:HTTPService id="custRequest"
> > > url="http://localhost/FlexTest/retrieve.php";
> > > result="resultHandler(event)"/>
> > >
> > > <mx:DataGrid dataProvider="{custData}">
> > > <mx:columns>
> > > <mx:DataGridColumn headerText="Customer"
> > > dataField="cust"/>
> > > <mx:DataGridColumn headerText="Status"
> > > dataField="status"/>
> > > </mx:columns>
> > > </mx:DataGrid>
> > >
> > > </mx:Application>
> > >
> > >  
> > >
> > 
> > 
> > 
> > -- 
> > http://indeegrumpee.spaces.live.com/
> >
>


Reply via email to