royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com.INVALID>
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.

-Alex

On 10/25/18, 6:04 AM, "Carlos Rovira" <carlosrovira@apache.org> wrote:

    Hi Alex,
    
    El mié., 24 oct. 2018 a las 23:00, Alex Harui (<aharui@adobe.com.invalid>)
    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
    > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&amp;data=02%7C01%7Caharui%40adobe.com%7Cc0fb5e4657904ae9167708d63a7a5612%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636760694433448030&amp;sdata=OMaRVGm05%2FVKFaGrtg9LeM3NcT%2B%2BmwzhVTWbV26igJQ%3D&amp;reserved=0
    >
    >
    >
    >
    

Mime
View raw message