Why do you think that this would work?

sanData.filterFunction=processFilter;

 

As Alex said, and as the error message says "filterFunction" is not a
property of HTTPService.  Look at the docs on filters.

 

Tracy

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of jovialrandor
Sent: Wednesday, September 19, 2007 7:42 PM
To: [email protected]
Subject: [flexcoders] Re: Cannot use 'filterFunction' from an
HTTPService request

 

Okay I added it to the result handler. here is the error message 
that i get:

"1119: Access of possible undefined property filterfunction through a 
reference with static type
mx.rpc.http.mxml.HTTPService"

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " 
layout="vertical"
creationComplete="initApp();" 
backgroundGradientColors="[#c0c0c0, #808080]" 
xmlns:mxeffects="com.adobe.ac.mxeffects.*">

public function initApp():void
{

sanData.send(); 

sanData.filterFunction=processFilter;
}

<mx:HTTPService id="sanData" url="someAPIURL"
result="sanDataHandler(event)" 
showBusyCursor="true"/>

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Typically you apply the filter in the result handler
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>

[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of jovialrandor
> Sent: Wednesday, September 19, 2007 3:27 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Re: Cannot use 'filterFunction' from an
> HTTPService request
> 
> 
> 
> So how do i get the data from the HTTPService before I can activate 
> the filterfunction?
> 
> thanks
> 
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
40yahoogroups.com>
> , "Alex Harui" <aharui@> wrote:
> >
> > Now I'm really lost. I don't think there is a filterFunction on an
> > HTTPService object.
> > 
> > 
> > 
> > initApp() is being called in creationComplete and there's no 
> guarantee
> > that the service has returned data by then.
> > 
> > 
> > 
> > ________________________________
> > 
> > From: [email protected]
<mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
40yahoogroups.com>
> 
> [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
40yahoogroups.com>
> ] On
> > Behalf Of jovialrandor
> > Sent: Wednesday, September 19, 2007 1:16 PM
> > To: [email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%
40yahoogroups.com> 
> > Subject: [flexcoders] Re: Cannot use 'filterFunction' from an
> > HTTPService request
> > 
> > 
> > 
> > Alex, I have the results returned in tin initApp function:
> > 
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> 
> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > 
> > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>
<http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > 
> " 
> > layout="vertical"
> > creationComplete="initApp();" 
> > backgroundGradientColors="[#c0c0c0, #808080]" 
> > xmlns:mxeffects="com.adobe.ac.mxeffects.*">
> > 
> > public function initApp():void
> > {
> > 
> > sanData.filterFunction=processFilter;
> > sanData.send(); 
> > 
> > }
> > 
> > --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%
> 40yahoogroups.com>
> > , "Alex Harui" <aharui@> wrote:
> > >
> > > When do yo apply the filter? initApp probably gets called 
before 
> > the
> > > results return.
> > > 
> > > 
> > > 
> > > ________________________________
> > > 
> > > From: [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%
> 40yahoogroups.com>
> > 
> > [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%
> 40yahoogroups.com>
> > ] On
> > > Behalf Of jovialrandor
> > > Sent: Wednesday, September 19, 2007 9:09 AM
> > > To: [email protected]
<mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
40yahoogroups.com>
> <mailto:flexcoders%
> 40yahoogroups.com> 
> > > Subject: [flexcoders] Cannot use 'filterFunction' from an 
> > HTTPService
> > > request
> > > 
> > > 
> > > 
> > > I want to setup a datagrid that can filter from a textfield. I 
> have 
> > > data coming back from an API using the HTTPRequest tag. I know 
> the 
> > > filterFunction only works with ArrayCollection, but I thought 
> that 
> > > the data returned was in form of a ArrayCollection.
> > > 
> > > However when I try to use the following function, it gives me 
an 
> > > error.
> > > 
> > > public function initApp():void
> > > {
> > > 
> > > // Set filter function // Be careful to set 
> > > filterFunction // only after ArrayCollection has been // 
> > > populated. 
> > > // sanData.filterFunction=processFilter;
> > > }
> > > 
> > > public function processFilter(item:Object):Boolean
> > > {
> > > var result:Boolean=false;
> > > 
> > > // If no filter text, or a match, then true 
> > > if (!item.name.length
> > > || item.Expr2.toUpperCase().indexOf
> > > (txtFilter.text.toUpperCase()) >= 0)
> > > result=true;
> > > 
> > > return result;
> > > }
> > > 
> > > Here is the HTTP call
> > > 
> > > <mx:HTTPService id="sanData" url="someAPI"
> > > result="sanDataHandler(event)"/>
> > > 
> > > Thanks
> > >
> >
>

 

Reply via email to