In general, removing stuff should be PAYG.  Not every app needs to remove
things, and removal is often way more expensive than adding.

For example, when an item is added to a sophisticated list, the various
beads have to do these things:
1) figure out if the item is on screen and a new renderer needs to be
added.
2) figure out if the item was added before the selectedIndex so the
selectedIndex needs to be updated
3) update the scrollbar (if any).

When removing, the various beads have more to do:
1) figure out if the item is on screen and its renderer needs to be
removed.
2) figure out if the renderer removed is on the last visible page of the
list and scrollbars are up and the item that will take up the removed
renderer needs to come from a lower index in the data provider
3) figure out if the item was added before the selectedIndex so the
selectedIndex needs to be updated
4) figure out if the item removed was the selectedIndex and thus decide
what to do about selectedIndex and selectedItem
5) update the scrollbar (if any).

HTH,
-Alex


On 12/4/17, 5:08 PM, "Peter Ent" <p...@adobe.com.INVALID> wrote:

>I need to think about this for a bit because I’m fiddling with this bit
>of code in List. I’ll get back to you in my tomorrow.
>
>Peter 
>
>
>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki <piotrzarzyck...@gmail.com>
>>wrote:
>> Hi Guys,
>> 
>> I have faced an issue where solution seems to be not so easy. I have MDL
>> Table (issue affects also List) with some rows.
>> 
>> If I simply assign to dataProvider = null it doesn't remove all
>>content. It
>> is because in our DataItemRendererFactoryForArrayData and other type of
>> that class we have in listeners of  "dataProviderChanged" this code [1].
>> Basically if we assign null to dataProvider we are not cleaning up item
>> renderers, but should we ?
>> 
>> Maybe there should be separate bead which allow to do such operations ?
>> 
>> Thoughts ?
>> 
>> [1] 
>>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.a
>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448485bd508
>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021216449919
>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.a
>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448485bd508
>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021216449919
>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>*
>> 
>> Thanks,
>> -- 
>> 
>> Piotr Zarzycki
>> 
>> Patreon: 
>>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat
>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448
>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480212
>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserved=0
>> 
>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat
>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448
>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480212
>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserved=0
>>>*

Reply via email to