Hard to tell from that code.  Are you working from an example on my blog 
(blogs.adobe.com/aharui) or FlexExamples?

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of chris.cobb40
Sent: Wednesday, January 07, 2009 9:42 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] DataGrid With CheckBox ItemRenderer


Hi

I'm hoping this is simple and I have done something silly.

I have a datagrid with an itemrenderer which is a CheckBox and I
have written the code below to deal with it. You will see some
references to custom events that I have written as well.

When I use it, the datagrid no longer updates on rollover and I
can't work out why. All that happens is it highlights the first row
you rollover and then stops.

Any ideas anyone ?

Thanks

Chris

package Components.Renderers
{
import Events.ColumnFilterEvent;
import Events.InitiativeFilterEvent;
import Events.IssueFilterEvent;

import Model.LandscapeModelLocator;

import flash.events.MouseEvent;

import mx.controls.CheckBox;
import mx.controls.DataGrid;

public class CenteredCheckBoxHeaderRenderer extends CheckBox
{
private var modelLocator:LandscapeModelLocator =
LandscapeModelLocator.getInstance();

public function CenteredCheckBoxHeaderRenderer() {
super();
}


override public function set data(value:Object):void
{
var pName:String = String
(this.parent.parent);
var myDG:DataGrid = listData.owner as
DataGrid;

switch(myDG.id) {

case ("InGrid"):
if (value.InVisible == "1") {
selected = true;
} else {
selected = false;
}
break;

case ("IsGrid"):
if (value.IsVisible == "1") {
selected = true;
} else {
selected = false;
}
break;

case ("CoGrid"):
if (value.CoVisible == "1") {
selected = true;
} else {
selected = false;
}
break;

default:
break;
}
}

override protected function clickHandler
(event:MouseEvent):void {
var myDG:DataGrid = listData.owner as
DataGrid;

super.clickHandler(event);


switch(myDG.id) {

case "InGrid":
var
initiativeFilterEvent:InitiativeFilterEvent = new
InitiativeFilterEvent((listData.rowIndex +
myDG.verticalScrollPosition) as Number, this.selected as Boolean);
dispatchEvent(initiativeFilterEvent);
break;

case "IsGrid":
var
issueFilterEvent:IssueFilterEvent = new IssueFilterEvent
((listData.rowIndex + myDG.verticalScrollPosition) as Number,
this.selected as Boolean);
dispatchEvent(issueFilterEvent);
break;

case "CoGrid":
var
columnFilterEvent:ColumnFilterEvent = new ColumnFilterEvent
((listData.rowIndex + myDG.verticalScrollPosition) as Number,
this.selected as Boolean);
dispatchEvent(columnFilterEvent);
break;

default:
break;
}
}
}
}

Reply via email to