Hi Alex

I had looked on your site originally but missed the CheckBoxList And 
DataGrid example the first time.

Now that I look at that I notice that I missed out (I'm an idiot):

        super.data = value;
        invalidateProperties();

at the end of the set data override - now that I have added that in 
it all works just fine.

Thanks very much for your help and I will be back to your site again 
for more info on editors when I get to that point.

Cheers

Chris

--- In [email protected], Alex Harui <aha...@...> wrote:
>
> Hard to tell from that code.  Are you working from an example on 
my blog (blogs.adobe.com/aharui) or FlexExamples?
> 
> From: [email protected] 
[mailto:[email protected]] On Behalf Of chris.cobb40
> Sent: Wednesday, January 07, 2009 9:42 AM
> To: [email protected]
> 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