yial2
12-24-2008, 10:59 PM
Hi eveybody,
I have a problem when trying to change datagrid's dataprovider then call invalidateList() to refresh inside a onItemRollOver function
import mx.events.ListEvent;
import mx.controls.DataGrid;
private var dg:DataGrid;
private var ar:Array = [
{c1:'Item 1A', c2:'Item 1B'},
{c1:'Item 2A', c2:'Item 2B'},
{c1:'Item 3A', c2:'Item 3B'}];
private function onInit():void
{
dg = new DataGrid();
dg.dataProvider = ar;
dg.addEventListener(ListEvent.ITEM_ROLL_OVER, onItemRollOver);
this.addChild(dg);
}
private function onItemRollOver(event:ListEvent):void
{
event.itemRenderer.data.c1 = "change " + event.rowIndex.toString();
(event.target as DataGrid).invalidateList();
}
The problem is that when I call invalidateList on itemrollover, the datagrid rolloverColor will no longer work. Has anybody experienced the same problem before? Is this a bug or it is just the way datagrid work? Any work around?
Thanks in advance!! I have been trying to find a way to work around this problem for a week without any success.
I have a problem when trying to change datagrid's dataprovider then call invalidateList() to refresh inside a onItemRollOver function
import mx.events.ListEvent;
import mx.controls.DataGrid;
private var dg:DataGrid;
private var ar:Array = [
{c1:'Item 1A', c2:'Item 1B'},
{c1:'Item 2A', c2:'Item 2B'},
{c1:'Item 3A', c2:'Item 3B'}];
private function onInit():void
{
dg = new DataGrid();
dg.dataProvider = ar;
dg.addEventListener(ListEvent.ITEM_ROLL_OVER, onItemRollOver);
this.addChild(dg);
}
private function onItemRollOver(event:ListEvent):void
{
event.itemRenderer.data.c1 = "change " + event.rowIndex.toString();
(event.target as DataGrid).invalidateList();
}
The problem is that when I call invalidateList on itemrollover, the datagrid rolloverColor will no longer work. Has anybody experienced the same problem before? Is this a bug or it is just the way datagrid work? Any work around?
Thanks in advance!! I have been trying to find a way to work around this problem for a week without any success.