Ok, sometimes it takes a while.  But, here's the answer to your original question Chaitu.  Add an event listener to the itemRenderer component.  This way you can retain the original values of the dataField and then change them if the user clicks the check box. You might want to add an undo function as well.

-TH

//------------------------------------------------------------------------------------------------------------------------------------------
//   itemRenderer component mxml
//------------------------------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="
http://www.adobe.com/2006/mxml"
 width="100" height="24"
 horizontalAlign="center" verticalAlign="middle"
 creationComplete="init();">
 
 <mx:Script>
  <![CDATA[
  
   import mx.core.Application;
   import flash.events.MouseEvent;
   
   public function init():void
   {
    Application.application.cbSelectAll.addEventListener(MouseEvent.CLICK, selectAll);
   }
   
   public function selectAll(event:MouseEvent):void
   {
    cbFollowUp.selected = Application.application.cbSelectAll.selected;
   }
  
  ]]>
 </mx:Script>
  
 <mx:CheckBox id="cbFollowUp" selected="{data.followUp}"/>
 
</mx:VBox>

//------------------------------------------------------------------------------------------------------------------------------------------
//   application mxml
//------------------------------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
 layout="absolute" creationComplete="initData();"
 xmlns="*">
 
    <mx:Script>
        <![CDATA[

   import mx.collections.*;

         // Sample Data
         private var DGArray:Array = [
            {message:'message1', followUp:false},
            {message:'message2', followUp:true},
            {message:'message3', followUp:false}];
           
         [Bindable]
         public var initDG:ArrayCollection;
         public function initData():void {
             initDG=new ArrayCollection(DGArray);
         }

  ]]>
    </mx:Script>
      
    <mx:VBox height="500" width="100%" textAlign="left" clipContent="true"
     horizontalAlign="center" verticalAlign="middle">
 
  <mx:Spacer height="1"/>
  <mx:CheckBox id="cbSelectAll" label="Follow-Up All"/>
  <mx:Spacer height="1"/>
 
  <mx:DataGrid id="dg" dataProvider="{initDG}"
   width="400" height="400" variableRowHeight="true" selectable="false">
      <mx:columns>
          <mx:Array>
              <mx:DataGridColumn width="100" headerText="Follow-Up" dataField="followUp"
               itemRenderer="cbFollowUpItemRenderer"/>
              <mx:DataGridColumn width="300" headerText="message" dataField="message"> 
               <mx:itemRenderer>
             <mx:Component>
                 <mx:VBox horizontalScrollPolicy="off" verticalScrollPolicy="off">
                     <mx:Text id="message" selectable="false" width="300" 
                         text="{data.message}"/>
                    </mx:VBox>
             </mx:Component>
           </mx:itemRenderer>
              </mx:DataGridColumn>      
          </mx:Array>
      </mx:columns>
  </mx:DataGrid>
 </mx:VBox>
 
</mx:Application>

//------------------------------------------------------------------------------------------------------------------------------------------
//   END
//------------------------------------------------------------------------------------------------------------------------------------------

--- In [email protected], "Tim Hoff" <[EMAIL PROTECTED]> wrote:
>
>
> Hi Chaitu,
>
> This might be what youre looking for. I would put the cbSelected
> variable in a model somewhere, but this works.
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
> <http://www.adobe.com/2006/mxml> ">
>
> <mx:Script>
> <![CDATA[
>
> [Bindable]
> public var cbSelected:Boolean = false;
>
> public function selectAll():void
> {
> cbSelected = cbSelectAll.selected
> }
>
> ]]>
> </mx:Script>
>
> <mx:CheckBox id="cbSelectAll" label="Follow-Up All"
> click="selectAll();"/>
>
> <mx:DataGrid id="dg">
> <mx:columns>
> <mx:Array>
> <mx:DataGridColumn width="120"
> headerText="Follow-Up">
> <mx:itemRenderer>
> <mx:Component>
> <mx:VBox
> xmlns:mx="http://www.adobe.com/2006/mxml
> <http://www.adobe.com/2006/mxml> ">
> <mx:Script>
> <![CDATA[
>
> import
> mx.core.Application;
>
> ]]>
> </mx:Script>
>
> <mx:CheckBox
> id="cbFollowUp" selected="{Application.application.cbSelected}"/>
>
> </mx:VBox>
> </mx:Component>
> </mx:itemRenderer>
> </mx:DataGridColumn>
> </mx:Array>
> </mx:columns>
> </mx:DataGrid>
>
> </mx:Application>
>
>
> Hope that this helps,
> Tim Hoff
>
>
> --- In [email protected], "Chaitu Vadlapatla"
> chaitu.vadlapatla@ wrote:
> >
> > Thank you so much. Would work beautifully. But I am using the
> checkCell more as item renderer inside a datagrid. On selecting one
> checkbox dummyCheckBox_cb I want to select all the check boxes inside my
> datagrid column. thanks
> >
> >
> >
> >
> >
> >
> > Sent: Wednesday, June 14, 2006 12:20 PM
> > To: [email protected]
> > Subject: [flexcoders] Re: calling custom component methods inside the
> parent application
> >
> >
> >
> > This should work as long as you define an id in the main application
> > mxml, for your CheckCell.mxml component.
> >
> > <yourNamespace:CheckCell id="checkCell" click="checkCell.dummy()"/>
> >
> > In the CheckCell.mxml:
> >
> > cbSelected = Application.application.dummyCheckBox_cb.selected;
> >
> > //----------------------------------------------------------
> >
> > However, you could do it this way.
> >
> > Define your component in the main application xmxl like this:
> >
> > <yourNamespace:CheckCell id="checkCell" cbSelected=
> > {dummyCheckBox_cb.selected}/>
> >
> > In the CheckCell.mxml:
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml
> <http://www.adobe.com/2006/mxml> ">
> >
> > <mx:Script>
> > <![CDATA[
> >
> > [Bindable]
> > public var cbSelected:Boolean;
> >
> > ]]>
> > </mx:Script>
> >
> > <mx:CheckBox id="followUpCB" selected="{cbSelected}"/>
> >
> > </mx:VBox>
> >
> > //----------------------------------------------------------
> >
> > Regards,
> > -TH
> >
> > --- In [email protected]
> <mailto:flexcoders%40yahoogroups.com> , "Chaitu Vadlapatla"
> > chaitu.vadlapatla@ wrote:
> > >
> > > <mx:CheckBox id="dummyCheckBox_cb" click="CheckCell.dummy()"
> > x="15" y="535"/>//this piece is in my main application mxml
> > >
> > > My problem is with the click function. On this click of the check
> > box I want to call a function inside my component mxml and I cannot.
> > The component MXML looks like this
> > >
> > > Component MXML named ="CheckCell.MXML
> > >
> > > <?xml version="1.0" encoding="utf-8"?>
> > >
> > >
> > >
> > > <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml
> <http://www.adobe.com/2006/mxml> ">
> > >
> > > <mx:Script>
> > >
> > > <![CDATA[
> > >
> > > // Define a property for returning
> > >
> > > // the new value to the cell.
> > >
> > > public var cbSelected:Boolean;
> > >
> > > public function dummy ()
> > >
> > > {
> > >
> > > cbSelected =
> > parentApplication.dummyCheckBox_cb.selected;
> > >
> > > }
> > >
> > > ]]>
> > >
> > > </mx:Script>
> > >
> > > <mx:CheckBox id="followUpCB"
> > selected="{cbSelected}" creationCompleteEffect=" dummy ()" />
> > >
> > > </mx:VBox>
> > >
> > > Thanks
> > >
> > > Chaitu.
> > >
> > >
> > >
> > >
> > >
> > > ________________________________
> > >
> > > From: [email protected]
> <mailto:flexcoders%40yahoogroups.com>
> > [mailto:[email protected]
> <mailto:flexcoders%40yahoogroups.com> ] On Behalf Of Luís Gustavo
> Sanabio
> > > Sent: Wednesday, June 14, 2006 6:37 AM
> > > To: [email protected] <mailto:flexcoders%40yahoogroups.com>
> > > Subject: Re: [flexcoders] calling custom component methods inside
> > the parent application
> > >
> > >
> > >
> > > What is raga?
> > >
> > > Maybe ID is missing.
> > >
> > > <mx:CheckBox id="raga" click="CheckCell.dummy()" x="15" y="535"/>
> > >
> > > Gustavo Sanabio
> > >
> > >
> > >
> > > 2006/6/13, Jeremy Lu wade.lu@:
> > >
> > >
> > >
> > > try this:
> > >
> > > public function dummy ()
> > >
> > > {
> > >
> > >
> > >
> > > cbSelected = parent.raga.selected;
> > >
> > >
> > > //or
> > >
> > > cbSelected =
> > Application.application .raga.selected;
> > >
> > >
> > >
> > > }
> > >
> > > ]]>
> > >
> >
>

__._,_.___

--
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
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to