RecordSet.filter(filterFunction, context)
A new RecordSet object that contains a reference, not a copy, to all the records that were selected by the filterFunction function.
Method. Creates a new RecordSet object by calling the filterFunction function once for each record in the RecordSet object and collecting all records, for which the filterFunction function returns true, into a new RecordSet object. The order of the records in the new RecordSet object is the same as their order in the original RecordSet object. The order in which the original RecordSet object is traversed during the filtering process is not defined.
If used on a RecordSet object that is not fully-populated, only the currently available records are filtered. The new RecordSet object does not inherit the original RecordSet object's list of views, nor any association with a server-side RecordSet object.
The following example demonstrates how to build a ListBox UI component that shows a filtered view of a RecordSet object:
#include "NetServices.as"
var allFlights =new RecordSet(["flight","numberOfStops"]);
allFlights.addItem({flight: "123", numberOfStops: 0});
allFlights.addItem({flight: "321", numberOfStops: 3});
allFlights.addItem({flight: "456", numberOfStops: 1});
allFlights.addItem({flight: "654", numberOfStops: 2});
function flightFilter(aRecord, requestedNumberOfStops)
{
return (aRecord.numberOfStops <= requestedNumberOfStops);
}
myListBox.setDataProvider(allFlights.filter(flightFilter, 2));
RecordSet.addView, RecordSet.sort
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flashremoting/mx/Using_Flash_Remoting_MX/asDict30.htm