|
You might want to look at the listData
which will give you more info as to which column the checkbox represents. The
data is shared across columns, so I think cbSelected will be true as soon as
any of your properties is not null. From: All, I've just signed up for the list hoping to
get some help on some Flex items and also contribute any way I can. I've
been developing in ColdFusion for 6 years and recently started integrating Flex
2.0 development with my CF development. Anyhow, enough about me, on to
my question. I'm attempting to setup a custom ItemRenderer (a checkbox)
in multiple DataGrid columns. I've successfully done this with one column
already but when trying to make my custom ItemRenderer generic enough so it
can be used across multiple columns I've run into issues. Below is
snippet of my DataGrid code as well as the code for the custom ItemRenderer.
The behavior I'm seeing is selecting the checkbox in the "groupOwner"
column affects - in odd ways - the checboxes in the other columns using the same
renderer. I'm pretty sure it's because all the columns reference the same name for the
editorDataField attribute. But, I'm not sure how to make the value of that
attribute different across columns and still use the same custom ItemRenderer.
Can anyone point me in the right direction?
// Custom Checkbox ItemRenderer // NOTE: Much of the code in the overridden
method is speculative and // probably all wrong. <?xml version="1.0"
encoding="utf-8"?> <mx:VBox
xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center"
horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:Script> <![CDATA[ import mx.events.FlexEvent; import mx.controls.Alert; import mx.core.Application; [Bindable] public var cbSelected:Boolean; override public function set
data(value:Object):void { if (value != null) { super.data = "" if (value.BISOWNER != null) { cbSelected = value.BISOWNER; } else if (value.BISEXPORTED != null) { mx.controls.Alert.show("bisexported");
cbSelected = value.BISEXPORTED; } else if (value.ALLOWEDITS != null) { cbSelected = value.ALLOWEDITS; } else if (value.BISVINDECODE != null) { cbSelected = value.BISVINDECODE; } } dispatchEvent( new
FlexEvent(FlexEvent.DATA_CHANGE)); } ]]> </mx:Script> <mx:CheckBox id="cbGeneric"
selected="{cbSelected}" click="cbSelected =
cbGeneric.selected" updateComplete="cbSelected =
cbGeneric.selected"/> </mx:VBox> // DataGrid Snippet <mx:DataGrid
id="dgGroupingSetup" dataProvider="{groupingSetup}"
itemEditEnd="processDGEdit(event)" width="100%"
editable="true" height="246"> <mx:columns> <mx:DataGridColumn
id="groupID" headerText="Group ID"
dataField="INVENTORYGROUPINGID" editable="false"
width="60"/> <mx:DataGridColumn
id="groupOwner" headerText="Group Owner"
dataField="BISOWNER" itemRenderer="ItemRenderers.GenericCheckboxRenderer"
rendererIsEditor="true" editorDataField="cbSelected"
width="85"/> <mx:DataGridColumn
id="exportData" headerText="Export Data"
dataField="BISEXPORTED"
itemRenderer="ItemRenderers.GenericCheckboxRenderer" rendererIsEditor="true"
editorDataField="cbSelected" width="80"/> <mx:DataGridColumn
id="allowEdits" headerText="Allow Edits"
dataField="ALLOWEDITS"
itemRenderer="ItemRenderers.GenericCheckboxRenderer"
rendererIsEditor="true" editorDataField="cbSelected" width="75"/>
<mx:DataGridColumn
id="vinDecode" headerText="VIN Decode"
dataField="BISVINDECODE"
itemRenderer="ItemRenderers.GenericCheckboxRenderer"
rendererIsEditor="true" editorDataField="cbSelected" width="80"/>
</mx:columns> </mx:DataGrid> | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe __,_._,___ |

