royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <>
Subject Re: ListCollectionView in Royale replacement
Date Thu, 25 Oct 2018 17:28:21 GMT
Hi Carlos,

So once the LCV has a localIndex, what code are you using to access the LCV's filtered items?
 You should be able to step into that code and it should end up in LCV.getItemAt and access
the localIndex.


On 10/25/18, 6:04 AM, "Carlos Rovira" <> wrote:

    Hi Alex,
    El mié., 24 oct. 2018 a las 23:00, Alex Harui (<>)
    > 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
    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?
    > --
    > Carlos Rovira

View raw message