flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joel Anderson (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (FLEX-35232) Filter for ArrayList Data Providers
Date Thu, 29 Dec 2016 23:39:58 GMT

     [ https://issues.apache.org/jira/browse/FLEX-35232?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Joel Anderson updated FLEX-35232:
    Attachment: TestFilteredArrayList.zip

I created a simple implementation, FilteredArrayList, that is just a subclass of ArrayList.

I created an IFilter interface to define the filter, rather than the Function used by ArrayCollection.
 I originally tried to use a Function, but I found that it did not convert properly in the
Javascript application.

This solution maintains a second ArrayList that represents the elements that match the given
filter.  The ArrayList functions are overridden to update this list as appropriate.

I confirmed that I could use FilteredArrayList with a DataGrid.  See TestFilteredArrayList.zip
for an example project.  Note that the changes will not be updated to DataGrid until you click

Some notes:
- This is a proof of concept.  The class needs some more robustness and testing before it
is ready for "production"
- I used the filtered list for the {{getItemAt}} and {{length}} implementation
- For other functions that use a specific index (addItemAt, removeItemAt, updateItemAt), I
used the index of the parent class.  This could be a bit unintuitive for some cases
- I have not implemented getItemIndex, itemUpdated, itemUpdatedAt, and setItemAt
- There is no way to read items directly from the underlying list, for now.
- I have not yet created a specialized interface for this class (i.e. IFilteredArrayList).
 I haven't seen an advantage to this, yet.
- I have not added any events to the functions.  

I have attached an example application as TestFilteredArrayList.zip.  The FilteredArrayList
implementation is in:
- src/collections/FilteredArrayList.as
- src/collections/IFilter.as

> Filter for ArrayList Data Providers
> -----------------------------------
>                 Key: FLEX-35232
>                 URL: https://issues.apache.org/jira/browse/FLEX-35232
>             Project: Apache Flex
>          Issue Type: New Feature
>          Components: FlexJS
>            Reporter: Joel Anderson
>            Priority: Minor
>              Labels: flexjs
>         Attachments: TestFilteredArrayList.zip
> I created this issue to track the progress for the feature discussed here:  http://apache-flex-development.2333347.n4.nabble.com/Filter-function-to-ArrayList-td57239.html
> The idea is add filtering based on a search string (or other criteria) for an ArrayList.
 This could then be used to add filtering to a DataGrid or List UI component.
> This is one of the features provided by the ArrayCollection class in Flex:  http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/collections/ListCollectionView.html#filterFunction

This message was sent by Atlassian JIRA

View raw message