Gotta use editField or dispatch an event.  The examples in the Flex docs on 
cellrenderers is a good one to look at.  If you want to allow the CheckBox 
to screw with the data in his cellRenderer, do this in his click function:

listOwner.editField(getCellIndex().itemIndex, getDataLabel(), 
check.selected);

That's, "In the dataProvider, at position 0, set the field 'selected' to a 
value of 'true'".

or:

myDataProvider[0].selected = true;

Otherwise, dispatch an event so the controller that hosts the view can mess 
with the data himself:

listOwner.dispatchEvent({type: "checkBoxClicked", target: listOwner, cell: 
this, selected: checkBox.selected});



----- Original Message ----- 
From: "fowleryj" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, November 10, 2005 4:46 PM
Subject: [flexcoders] Recognizing when a CheckBox inside a DataGrid is 
clicked


[env: Flex 1.5 with Cairngorm architecture]

I am using the CheckBoxCellRenderer provided by Peter Ent via this
download:
http://www.markme.com/pent/archives/flex/solutions/cellrenderers.zip

I have my program working such that when a user clicks the Save button
in my mxml file, all the rows whose CheckBoxes are checked are stored
in a new Array by a save() function in the mxml's ViewHelper.

What I would like to do now is update the text in one of the cells
when the CheckBox is clicked. To be more specific, each row in the
DataGrid has a "date" column, and when the row's CheckBox is clicked,
I'd like the current date to replace the date displayed in that row's
"date" column.

However, I can't figure out how to get the CheckBox to realize it has
been clicked so that I can call the updateDate() function in the
mxml's ViewHelper. I tried modifying the code in the
CheckBoxCellRenderer class, but from there, I couldn't find an easy
way to access the mxml's DataGrid and its dataProvider. I tried using
the "change" property of the DataGrid, but that only recognizes that a
row has been selected, not that a CheckBox has been clicked.

[As an aside, I noticed while I was modifying the CheckBoxCellRenderer
that the setValue() function is called twice everytime the mouse
passes over a DataGrid row containing a checked CheckBox(es). This
seemed odd.]

Thanks in advance!






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links








------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to