Peter,

I have figure out what is wrong in case of List. I reported in the previous
email that in the ListExample once you remove one item, something is wrong
with selection. Issue happened when you removing item in the middle of
collection.

Let's say that you have 5 items and you are removing item with index = 2.
Removing will work properly, but StringItemRenderer ->
DataItemRenderer -> UIItemRendererBase
<- has property "index" which is basically not being refreshed after
remove. In the result renderers has following indexes:

0,
1,
3,
4

Which is messes up selection and roll over color changes. How actually fix
that ? My first thought was that ListView should listen for "layoutNeeded"
(we are dispatching that event after remove, add etc.) and refresh indexes
of all renderers.

The second thought is that ListView should listen for remove event, where
we will have index of removed row, so we will be able loop through part of
the collection and refresh rest of the indexes. It is more efficient, but
maybe this is job for new type of View (bead) - ListRemoveView bead ?

Looking forward to your thought once you get back from Vacation. :)

Thanks, Piotr



2017-12-22 15:05 GMT+01:00 Piotr Zarzycki <piotrzarzyck...@gmail.com>:

> Hi Peter,
>
> I haven't checked your branch yet, but I just pushed couple of things to
> the develop which I needed for my examples. Here is the list of beads which
> we currently have and can be used for List. I think names are self
> explanatory.
>
> DynamicAddItemRendererForArrayListData
>
> DynamicUpdateItemRendererForArrayListData
>
> DynamicRemoveItemRendererForArrayListData
>
> DynamicRemoveAllItemRendererForArrayListData
>
> DynamicRemoveAllByNullItemRendererForArrayListData
>
> All beads above should be used once you set for your list: 
> IDataProviderItemRendererMapper: 
> ClassReference("org.apache.royale.html.beads.DataItemRendererFactoryForArrayList")
>
> We have also DynamicItemsRendererFactoryForArrayListData - which is doing 
> actually two things. Create all items once someone set dataProvider (the same 
> logic as in DataItemRendererFactoryForArrayList) AND handle adding to
>
> ArrayList (the same logic as in DynamicAddItemRendererForArrayListData) - It 
> duplicates logic from those both beads.
>
>
> Two Scenarios with DynamicItemsRendererFactoryForArrayListData:
>
> 1) If we use DynamicItemsRendererFactoryForArrayListData simply in the List 
> as it is in our ListExample [1] we don't have to remember to setup:
>
> IDataProviderItemRendererMapper: 
> ClassReference("org.apache.royale.html.beads.DataItemRendererFactoryForArrayList").
>
> However in that scenario we will have in List totally useless bead 
> DataItemRendererFactoryForArray which is being added default to the List.
>
> 2) If we use DynamicItemsRendererFactoryForArrayListData and we add in CSS  
> IDataProviderItemRendererMapper: 
> ClassReference("org.apache.royale.html.beads.DataItemRendererFactoryForArrayList")
>
> I'm not sure what can happen actually, cause both beads are using the same 
> logic to create item renderers. Can be situation when one bead is create 
> renderers and second one re do this work again ? :)
>
>
> Thanks, Piotr
>
>
>
> [1] 
> https://github.com/apache/royale-asjs/blob/24b09c787fc1da2d0a19895a2b2d4a440e26c597/examples/royale/ListExample/src/main/royale/MyInitialView.mxml#L69
>
>
>
> 2017-12-19 20:35 GMT+01:00 Olaf Krueger <m...@olafkrueger.net>:
>
>> Peter, great to read something about these "Collections" and "Hierarchical
>> data" stuff here!
>> Thanks for working on this, have a nice time and enjoy your break!
>>
>> Olaf
>>
>>
>>
>> --
>> Sent from: http://apache-royale-development.20373.n8.nabble.com/
>>
>
>
>
> --
>
> Piotr Zarzycki
>
> Patreon: *https://www.patreon.com/piotrzarzycki
> <https://www.patreon.com/piotrzarzycki>*
>



-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*

Reply via email to