Hi Chaitu,

 

Here is the solution…try this code

If your datafield name is “user”

<mx:DataGridColumn headerText="user name" dataField="user”/>

 

Then write a itemRenderer

 

<?xml version="1.0" encoding="utf-8"?>

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:Script>

     <![CDATA[

          // Define a property for returning
          // the new value to the cell.

          public var cbSelected:Boolean;

          ]]>       

      </mx:Script>

                  

      <mx:CheckBox id="user"
                    height="100%" width="100%"
                    selected="{data.user}" />

   

</mx:VBox>

 

 

 

.


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Hoff
Sent: Wednesday, June 14, 2006 7:08 PM
To: [email protected]
Subject: [flexcoders] Re: calling custom component methods inside the parent application

 

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">
   
      <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">
                                                <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" <[EMAIL PROTECTED]> 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