Sounds good. I may not be able to really review this until we get back to a regular schedule on Jan 3. Right now I get only get a few minutes here and there. Thanks for working on it.
A couple of thoughts in-line... -Alex On 12/29/16, 3:27 PM, "JoelProminic" <j...@prominic.net> wrote: >I started some work on this feature. I created a JIRA issue here: >https://issues.apache.org/jira/browse/FLEX-35232 > >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 in JIRA for an example project. Note that the >changes will not be updated to DataGrid until you click "Refresh" > >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 It might be reasonable to make a read-only versions of the classes and APIs that don't have these "write" methods so that basic implementations can avoid the whole topic of what index means when writing. >- 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. If any, the advantage would be that folks will implement different versions with different strategies for the "write" methods. >- I have not added any events to the functions. > > >I have attached an example application as TestFilteredArrayList.zip to the >JIRA issue. The FilteredArrayList implementation is in: >- src/collections/FilteredArrayList.as >- src/collections/IFilter.as > >Joel Anderson >My Apache Flex community contribution is working on the open source >Moonshine-IDE.com for FlexJS. > > > > >-- >View this message in context: >http://apache-flex-development.2333347.n4.nabble.com/Filter-function-to-Ar >rayList-tp57239p57642.html >Sent from the Apache Flex Development mailing list archive at Nabble.com.