On 2/7/06, Jonathan Miranda <[EMAIL PROTECTED]> wrote:

> Well I'm closer but no cigar yet. I can get the dataProvider to update with 
> the checkbox click, but each checkbox click requires 2 clicks! One to get 
> focus in the box and one to actually change the checkbox…

There are two ways to set an editor: (1) the "editorClass" property,
and (2) the "cellRenderer" and "isCellEditor" properties.  In the
latter case, the cell renderer is also the cell editor (like your
CheckBox).

You don't have to use an inline cell renderer if all you need is a
simple CheckBox.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml";
xmlns="*" layout="vertical">
<mx:Array id="array">
        <mx:Object Name="Item 1" Selected="false" />
        <mx:Object Name="Item 2" Selected="true" />     
</mx:Array>
<mx:DataGrid dataProvider="{array}" editable="true">
        <mx:columns>
                <mx:DataGridColumn columnName="Name" />
                <mx:DataGridColumn columnName="Selected"
                        cellRenderer="mx.controls.CheckBox"
                        isCellEditor="true"
                        editorProperty="selected" />
        </mx:columns>
</mx:DataGrid>
</mx:Application>


>and I can't figure out how to center the Checkbox now since it's not
in an HBox anymore.

Same example above with an inline cell renderer based on HBox:

                        <mx:cellRenderer>
                                <mx:Component>
                                        <mx:HBox horizontalAlign="center">
                                                <mx:Boolean id="selected">
                                                        {checkBox.selected}
                                                </mx:Boolean>
                                                <mx:CheckBox id="checkBox"
                                                        
selected="{dataObject.Selected}" />
                                        </mx:HBox>
                                </mx:Component>
                        </mx:cellRenderer>


--
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