Those of us in this forum like to be helpful, but it is not our responsibility to write code for you. You, however, must show some diligence in exploring the documentation, verifying that errors you get are not simple mistakes on your part and asking appropriate questions with accurate information.
The code snippet you show below does not show that you applied the filter in the result handler. In fact, it is very similar to the code you showed before which should also have generated the same error. This makes seem to me that you are not applying appropriate diligence and makes me not want to help you. You can post again with accurate information including the sanDataHandler code and we will try once more, but after that, you may not get much more assistance. Before you post again, please try to fix the errors yourself. Note that: filterFunction is applied to the collection, not HTTPService. The collection is either the result of the service call or will be generated by the list class based on the resultFormat. -Alex ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of jovialrandor Sent: Wednesday, September 19, 2007 4: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 > > > > > >

