Hi,

Thanks for help. But still i dont know how to apply this solution in
my case.

I am using CenteredCheckBox.mxml as itemrenderer for my CheckBox
Column.

What I am doing here is when user checked some value it get reflected
in DataProvider too.

Have a look on snippet:

CenteredCheckBox.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml";  width="100%"
height="35" horizontalAlign="center" verticalAlign="middle">
        <mx:Script>
                <![CDATA[
                        import mx.controls.listClasses.BaseListData;
                        import mx.events.DataGridEvent;
                        import mx.controls.CheckBox;
                        import 
com.basepin.view.TeamManager.dialogs.VoidIssueDlg;
                        import com.basepin.model.interfaces.ISelectable;
                        import mx.core.IDataRenderer;

                        override public function set data(value:Object):void
                         {

                              if(value == null)
                                      return;
                            _data = value;
                             cbx.selected = Boolean(_data.selected);
                        }

                    override public function get data():Object
                    {
                        if (_data != null)
                                return _data;
                        return null;
                    }

                        private function updateSelected():void
                        {
                                _data.selected = cbx.selected;
                        }

                        private var _data:Object;

                        public function get selected():Object
                        {
                                return Object(_data.selected);
                        }
                ]]>
        </mx:Script>
        <mx:CheckBox  id="cbx" width="14" change="updateSelected()" />
</mx:HBox>



And My Datagrid Exactly look like this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; width="100%"
height="100%">

        <mx:Script>
                <![CDATA[
                        import mx.collections.ArrayCollection;
                        [Bindable]
                        public var _acProjectIssueLevels:ArrayCollection;
                ]]>
        </mx:Script>

        <mx:DataGrid id="dgLevels" width="100%" height="100%" editable="true"
dataProvider="{_acProjectIssueLevels}" verticalAlign="middle"
sortableColumns="false">
                <mx:columns>
                        <mx:DataGridColumn headerText="Level" dataField="name"
editable="false"  textAlign="center" width="220"/>
                        <mx:DataGridColumn headerText="Impacted"  width="150"
textAlign="center"
itemRenderer="com.basepin.view.components.CenteredCheckBox"
rendererIsEditor="true" editorDataField="selected"
dataField="selected"/>
                        <mx:DataGridColumn headerText="Room" 
dataField="level_room"
width="250" textAlign="center">
                                <mx:itemEditor >
                                        <mx:Component>
                                                <mx:TextArea textAlign="center" 
verticalCenter="0" width="100%"
height="35" wordWrap="true" borderStyle="none" editable="true"
maxChars="45"   />
                                        </mx:Component>
                                </mx:itemEditor>
                        </mx:DataGridColumn>
                        <mx:DataGridColumn headerText="Grids" 
dataField="level_grids"
width="250" textAlign="center">
                                <mx:itemEditor >
                                        <mx:Component>
                                                <mx:TextArea textAlign="center" 
verticalCenter="0" width="100%"
height="35" wordWrap="true" borderStyle="none" editable="true"
maxChars="45"  >
                                                </mx:TextArea>
                                        </mx:Component>
                                </mx:itemEditor>
                        </mx:DataGridColumn>
                </mx:columns>
        </mx:DataGrid>
</mx:Canvas>


Please have a look on flow and suggest some solution and meanwhile i
am trying yours solution.

Thanks Again



On Apr 16, 7:54 am, Fehmina Kanuga <[email protected]>
wrote:
> hi, just try if this works
>
> <mx:DataGridColumn headerText="Critical" dataField="critical"
> rendererIsEditor="true" editorDataField="selected" color="#000000">
>
> <mx:itemRenderer>
>
> <mx:Component>
>
> <mx:VBox height="30" horizontalAlign="center">
>
> <mx:CheckBox id="chk" selected="{data.level_room == level_roomId.text*'*}"/>
>
> </mx:VBox>
>
> </mx:Component>
>
> </mx:itemRenderer>
> </mx:DataGridColumn>
>
> assign id to your textarea
>
> <mx:DataGridColumn headerText="Room" dataField="level_room"
> width="250" textAlign="center">
>        <mx:itemEditor >
>                <mx:Component>
>                        <mx:TextArea wordWrap="true"  editable="true"
> maxChars="45" id="level_roomId"  />
>                </mx:Component>
>        </mx:itemEditor>
> </mx:DataGridColumn>
>
> another sollution :
>
> write a private function :
> private function renderCheckbox():void {
>  if( level_roomId.text != null) {
>     chk.selected == true;}
>
>  else {
>    chek.selected == false;}
> }
>
> and
> <mx:CheckBox id="chk" selected = renderCheckbox()>
>
> chcek if this works.
> othrwise will give another solution
>
>
>
>
>
> On Thu, Apr 15, 2010 at 10:49 AM, nikhil <[email protected]> wrote:
> > Hi,
>
> > I have one datagrid where one column is for checkboxes and one column
> > is for TextArea.
>
> > So I used itemRenderer for checkbox like
> > <mx:DataGridColumn
> > itemRenderer="com.basepin.view.components.CenteredCheckBox"
> > rendererIsEditor="true" editorDataField="selected"
> > dataField="selected"/>
>
> > and for TextArea i used itemEditor like,
>
> > <mx:DataGridColumn headerText="Room" dataField="level_room"
> > width="250" textAlign="center">
> >        <mx:itemEditor >
> >                <mx:Component>
> >                        <mx:TextArea wordWrap="true"  editable="true"
> >  maxChars="45"   />
> >                </mx:Component>
> >        </mx:itemEditor>
> > </mx:DataGridColumn>
>
> > Now my problem is how to checked the checkbox on change in the
> > TextArea. When user enter some text in textArea the associated
> > checkbox should get checked automatically.
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Flex India Community" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<flex_india%2bunsubscr...@googlegrou 
> > ps.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/flex_india?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/flex_india?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to