简体   繁体   中英

Flex Spark List LabelItemRenderer remove selection when other list item enters down state

The Spark List with a mobile theme has kind of a weird behavior that I need to disable in favor of a context menu.

The default behavior of that list is that an item only loses it's selection color when another item has entered the selected state. That means that for the moment the user remains in the down state on an item (either by mouse down or tap and hold), two items show the selection color, the one that is still selected, and the current one with the down state.

What I need is that selected items lose their selection color/state as soon as another items enters the down state, so basically the selection state needs to be set as soon as the down state is entered.

Why do I need this you may ask, let me explain; My lists need a context menu which will be opened on long press. And since long press doesn't include a mouse up event before the long press event is triggered, the item won't get selected, thus other items won't lose their selection color.

My itemRenderer is a standard LabelItemRenderer written in AS and it would be great to change this functionality in the ItemRenderer, not the parent component.

Has anyone got a clue how to accomplish this?

Since you're using the LabelItemRenderer , I assume you're building a mobile app. This is kind of a guess; but...

Can you add a Long Press event handler to the itemRenderer, and change the selected property of the itemRenderer in the event handler?

I'm not sure if such a change in the itemRenderer will also change the actual List, though. In theory it should not.

Aside from that, if your Long Press event bubbles up from the itemRenderer, you can listen to it on the List class and change the selectedItem that way, before popping up your new menu.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM