Hi Alex

Thanks for the reply.

I started out from your website and then had a look at some others 
as well - sorry can't remember which I have looked at as there have 
now been so many.

Yours site is a great resource and it helped me a lot but I kind of 
figured that I needed to make some additions because of my 
requirements which are:

1. The DataGrid has an XML file as the data provider.

2. One field in the XML file provides the initial value for the 
checkbox on applicationcomplete.

3. I need then to be able to store away somewhere in the app when a 
user clicks/unclicks the checkboxes on rows - I use this information 
to dictate what is shown or not shown on the graph in the app.

4. I need to generate a custom event in order that the graph and 
some other custom components are aware that a checkbox has been 
clicked/unclicked so they can take appropriate action.

I'm using Cairngorm so I was going to set up an object in the 
modelLocator to save the checkbox statii and was going to generate 
cairngorm events from the clickhandler method.

The code below does not use Cairngorm at the moment - it just takes 
the value of the checkbox straight from the XML file and then issues 
simple custom events to test whether they are issued correctly.

All works fine as and expected except for some reason the rollover 
functionality stops working on the datagrid and I really don't know 
why.

I have trawled the Internet for a similar problem but nobody seems 
to have had the same thing - nearest I could find was one person who 
had a problem with rollover text coloration - they sorted it using 
by overrriding the validatenow method and draw the text color change 
manually. I had a go with that myself and it didn't seem to work. I 
also noticed that you said in your blog that you really shouldn't do 
it unless absolutely necessary.

So really I am looking for any clues that might help me,. If I'm 
heading in the wrong direction then please tell me and I will be 
very grateful. I am hoping that because I'm the only one seemingly 
having the problem - its something stupid I have done !

Thanks

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