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


On 5/17/10 6:56 AM, "Angelo Anolin" <[email protected]> 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>[email protected]</EmployeeEmail>
    <EmployeeNTUsername>ljames</EmployeeNTUsername>
  </Table>

  <Table>
    <EmployeeID>124</EmployeeID>
    <EmployeeFirstName>Kobe</EmployeeFirstName>
    <EmployeeLastName>Bryant</EmployeeLastName>
    <EmployeeEmail>[email protected]</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:XMLListCollection 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 <[email protected]>
To: "[email protected]" <[email protected]>
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