Hi Alex,

El mié., 24 oct. 2018 a las 23:00, Alex Harui (<[email protected]>)
escribió:

> Hi Carlos,
>
> I just looked myself.  The Royale LIstCollectionView's getItemAt does
> check the localIndex first.  I thought that check might have been commented
> out.  It isn't so I think you'll have to see if getItemAt gets called at
> all.
>

I put some traces in MX lib and I see that localIndex is undefined and it
enter in the else
return list.getItemAt(index, prefetch);


>
> One important piece in Royale is strong typing.  ListCollectionView is a
> Proxy, so if you are accessing it via array indexing instead of calling
> getItemAt, you must make sure the LCV is strongly typed.  IOW,
>
> myRemoteObjectOperation.lastResult[0]
>
> will not work, but
>
> (myRemoteObjectOperation.lastResult as ListCollectionView)[0]
>
> should work and result in a call to getProperty which should call
> getItemAt.
>

I'm doing this code (not related to MX RO), is a simple test with no UI or
controls involved to test it quickly :

//sourceList is an ArrayCollection
var lcv:ListCollectionView = new ListCollectionView(sourceList);
lcv.filterFunction = someFilterLogic; // Note: this only works in this way,
try to assign the complete function here as anonymous will fail, this is
not a problem, but I think is ok to expose this since it could be a
colateral problem not related to this
lcv.refresh();
trace(lcv)

function someFilterLogic(param:String):Boolean {
                    // this logic returns true or false, since is not
important for this explanation
                };

The trace of lcv shows the same items than sourceList ArrayCollection (in
my example 3 items)

I see in the trace that
* The object is a ListCollectionView
* it has localIndex with filtered right items (is no more undefined and is
an Array, in my example just 2 items, as I expected)

So while this code in flex is ok (since is almost the same as in royale),
in Royale something is working wrong and LCV is returning the collection
not filtered.

Maybe could it be something related to the Proxy not properly set for LCV?

Thanks





>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>
>
>
>

Reply via email to