You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Paul Hastings <pa...@gmail.com> on 2013/11/14 05:17:09 UTC

filtered ArrayCollections

not sure if this is an issue or just me not understanding.

when i filter an ArrayCollection (ac), i see its length change to the expected 
size based on the filter condition but if i send that filtered ac to my backend 
(coldfusion) for reporting the whole, unfiltered ac is passed back. i guess its 
passing back the ac array source rather than ac wrapper?

i've already worked around it but curious if this is expected/designed? and is 
my workaround "ok" (loop over filtered ac & add items to new array to pass to 
backend)?

thanks.


Re: filtered ArrayCollections

Posted by Paul Hastings <pa...@gmail.com>.
On 11/14/2013 12:28 PM, Deepak MS wrote:
> Looks like you are passing ac.source to your backend?

not specifically, passing the ac to remote cf function. underneath i think 
remoting is just sending the source array.

> ��� ��� ��� var filteredArray:Array = ObjectUtil.copy(yourAC.toArray()) as Array;

thanks i'll benchmark against a simple loop & add--these are small collections 
<150 elements.


Re: filtered ArrayCollections

Posted by Deepak MS <me...@gmail.com>.
When you apply filter, only ac get's filtered, ac.source will still be the
same. Looks like you are passing ac.source to your backend?

You may give this a try:
            yourAC.filterFunction = yourFilterFunction;
            yourAC.refresh();

            var filteredArray:Array = ObjectUtil.copy(yourAC.toArray()) as
Array;


On Thu, Nov 14, 2013 at 9:47 AM, Paul Hastings <pa...@gmail.com>wrote:

> not sure if this is an issue or just me not understanding.
>
> when i filter an ArrayCollection (ac), i see its length change to the
> expected size based on the filter condition but if i send that filtered ac
> to my backend (coldfusion) for reporting the whole, unfiltered ac is passed
> back. i guess its passing back the ac array source rather than ac wrapper?
>
> i've already worked around it but curious if this is expected/designed?
> and is my workaround "ok" (loop over filtered ac & add items to new array
> to pass to backend)?
>
> thanks.
>
>

Re: filtered ArrayCollections

Posted by Paul Hastings <pa...@gmail.com>.
On 11/14/2013 12:16 PM, Alex Harui wrote:
> Yes, it serializes the source, not its current view.

ok.

> Seems ok.  You could also try subclassing and changing what
> readExternal/writeExternal does.  Maybe some committer will add a flag and
> build in the option.

probably not worth the effort, i think this is the first time i've needed to do 
this in i can't remember when.

thanks.


Re: filtered ArrayCollections

Posted by Alex Harui <ah...@adobe.com>.

On 11/13/13 8:17 PM, "Paul Hastings" <pa...@gmail.com> wrote:

>not sure if this is an issue or just me not understanding.
>
>when i filter an ArrayCollection (ac), i see its length change to the
>expected 
>size based on the filter condition but if i send that filtered ac to my
>backend 
>(coldfusion) for reporting the whole, unfiltered ac is passed back. i
>guess its 
>passing back the ac array source rather than ac wrapper?
Yes, it serializes the source, not its current view.
>
>i've already worked around it but curious if this is expected/designed?
>and is 
>my workaround "ok" (loop over filtered ac & add items to new array to
>pass to 
>backend)?
Seems ok.  You could also try subclassing and changing what
readExternal/writeExternal does.  Maybe some committer will add a flag and
build in the option.

-Alex