I've two problems, the second of which is only an issue because it's a possible way to fix the first!
I'm developing a Flex 4.1 application, using a Spark theme: I can't change these; Halo isn't an option.
It's providing the facility to fill multiple-selected cells of an AdvancedDataGrid with a single character, from a single keypress. So the user selects their cells using the Shift key, hits H (for example) and sees all the cells update with H, without using an itemEditor but via grid keyDown events instead. Then they click somewhere else and the selection should clear.
However the visible selection isn't fully cleared and the newly coloured cells won't all change from their selected colour.
Underneath I can verify that the selection has cleared: mygrid.selectedCells is empty. All behaviour afterwards points to some kind of display glitch with the grid: The cells aren't selected any more but they look like they are.
After the keypress over the selected cells:
After the mouse-click away to clear the selection:
Note the alternating columns: this is always the way it happens.
This is using the default itemRenderer. It still happens with a very basic custom itemRenderer but I haven't looked further down this avenue because there's a complication that I can't get the label in the itemRenderer to recognise backgroundAlpha so the 'selected' background is barely visible and looks terrible. I read somewhere that this is a problem with Spark, and it's certainly true that if I switch back to the default renderer, all is fine. Well...except for this selection-colour glitch.
Here's how it looks with the custom renderer:
If I'm missing something obvious, here's the itemRenderer I tried:
<?xml version="1.0" encoding="utf-8"?>
<s:MXAdvancedDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
focusEnabled="true" autoDrawBackground="true"
>
<s:layout>
<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
</s:layout>
<s:Label id="lblData" text="{listData.label}" backgroundAlpha="0"/>
</s:MXAdvancedDataGridItemRenderer>
So in summary: what I need is a way to fix the multiple selection glitch; the item renderer problem is only an issue if I need a custom itemRenderer to fix the selection glitch.
Any help gratefully received.