How to find ArrayList length after filtered in apache royale

100 views Asked by At

This code snippet is from TDJ List

<j:Card>
   <html:H3 text="Jewel List"/>
   <j:List id="list" width="200" height="300" dataProvider="{simple}" change="onChange(event)"/>
            <j:TextInput width="200">
                <j:beads>
                    <j:TextPrompt prompt="filter list..."/>
                    <j:SearchFilterForList list="{list}"/>
                </j:beads>
            </j:TextInput>
            <j:Label id="selected" html="{describeItem(list.selectedItem)}"/>                               
</j:Card>

There is j:SearchFilterForList

What i want to know is when its work (type some text on the filter textbox), how to find filtered list length?

Thankyou

1

There are 1 answers

2
Carlos Rovira On

Just use the new "length" property just recently added. Tour de Jewel was updated as well showing the use of this new bead property in the List examples.

<j:Label html="{'list filtered length: ' + filter.length}"/>
<j:TextInput>
    <j:beads>
        <j:TextPrompt prompt="filter list..."/>
        <j:SearchFilterForList id="filter" list="{iconList}"/>
    </j:beads>
</j:TextInput>

Notice that the filtering performed by this bead is only visual, and the underlaying dataProvider is not filtered itself. To get a filtered view of the dataProvider you should use ArrayListView API, that is similar to flex ListCollectionView with filterFuncion.