Hi Alex,

Thanks for your replies.

I was able to figure out what was causing the filter function not to work.  

In the dataset which I am returning, there are some rows which have a NULL 
value.  What I did was modified the dataset so that NULL values are returned as 
empty strings which does not break the XML.

Angelo



________________________________
From: Alex Harui <[email protected]>
To: "[email protected]" <[email protected]>
Sent: Mon, 17 May, 2010 12:22:29
Subject: Re: [flexcoders] XML List Collection Filter Function

  
Try:
return itm.EmployeeEmail. toString( ).toLowerCase( ).indexOf( tiSearch. 
text.toLowerCase ()) != -1;


On 5/17/10 6:56 AM, "Angelo Anolin" <angelo_anolin@ yahoo.com> wrote:



>> 
>> 
>>   
>
>Hi Alex,
>
>>The XML being returned by the web service is as follows:
>
>><NewDataSet>
>>  <Table>
>>    <EmployeeID>123</EmployeeID>
>>    <EmployeeFirstName>Lebron</EmployeeFirstName>
>>    <EmployeeLastName>James</EmployeeLastName>
>><EmployeeEmail>lja...@cavaliers. com</EmployeeEmail>
>>    <EmployeeNTUsername>ljames</EmployeeNTUsername>
>>  </Table>
>
>>  <Table>
>>    <EmployeeID>124</EmployeeID>
>>    <EmployeeFirstName>Kobe</EmployeeFirstName>
>>    <EmployeeLastName>Bryant</EmployeeLastName>
>>    <EmployeeEmail>kbry...@lakers. com</EmployeeEmail>
>>    <EmployeeNTUsername>kbryant</EmployeeNTUsername>
>>  </Table>
>
>>  <Table>
>>    <EmployeeID>128</EmployeeID>
>>    <EmployeeFirstName>Steve</EmployeeFirstName>
>><EmployeeLastName>Nash</EmployeeLastName>
>><EmployeeEmail>[email protected]</EmployeeEmail>
>>    <EmployeeNTUsername>snash</EmployeeNTUsername>
>>  </Table>
>
>>From the web service, I assign the Result Event to an XML variable:
>
>>_xmlPlayers = XML(event.result) ;
>
>>And I am converting it into an XMLListCollection via the following MXML tags:
>
>><mx:XMLListCollectio n id="xmllcPlayers" source="{_xmlPlayers. Table}" />
>
>>In the filterfunction of the xmllistcollection, I have the scripts:
>
>>private function filterPlayers( item:Object) :Boolean
>>{
>>return itm.EmployeeEmail. toLowerCase( ).indexOf( tiSearch. text.toLowerCase 
>>()) != -1;
>>}
>
>>The tiSearch is a text input box where the event to filter is triggered on 
>>each keystroke (via the textinput ! change event).
>
>>Using the other fields such as FirstName or LastName, the search works well 
>>but not on the email field. 
>
>>Any ideas?
>
>>Thanks.
>
>>Angelo
>
>
________________________________
From:Alex Harui <aha...@adobe. com>
>To: "flexcod...@yahoogro ups.com" <flexcod...@yahoogro ups.com>
>Sent: Fri, 14 May, 2010 12:09:50
>Subject: Re: [flexcoders] XML List Collection Filter Function
>
>>  
>>   
>
>Post the XML and the filterfunction
>
>
>>On 5/14/10 8:54 AM, "Angelo Anolin" <angelo_anolin@ yahoo.com> wrote:
>
>
>
>>>> 
>>>> 
>>>>   
>>
>>Hi FlexCoders,
>>
>>>>For some reason, I do not know why my filter function being applied to an 
>>>>XML list collection does not filter those fields that are email addresses.
>>
>>>>Is this a bug or something?
>>
>>>>I traced the filter function and it is returning a true or false value 
>>>>depending on the index of the search field but the particular row does not 
>>>>get filtered out.
>>
>>>>Thanks.
>>
>>>>Angelo
>>
>>>> 
>>>> 
>>>>   
>>
>>
>>
-- 
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs. adobe.com/ aharui
 
 


      

Reply via email to