Access inline RadioButton within itemRenderer in a DataGrid

I have a RadioButton column in a DataGrid. I added the RadioButtons in this way:
<mx:DataGrid id="dg" x="0" y="25" width="510" height="260" selectedIndex="0" dataProvider="{department.prof}" showHeaders="false" itemClick="handleClick(event);" >
      <mx:columns>
          <mx:DataGridColumn headerText="Selection" dataField="selection" width="75" >
               <mx:itemRenderer>
                      <mx:Component>
                             <mx:VBox>
                                 <mx:RadioButton id="rb" />
                             </mx:VBox>
                      </mx:Component >
               </mx:itemRenderer>
          </mx:DataGridColumn>
          //Other <mx:DataGridColumn> go here. Their inline components' contents are provided with the dataProvider="{department.prof}"
     </mx:columns>
</mx:DataGrid>
I want the RadioButton in the clicked row is selected and others are unselected using the handleClick(event) function:
private function handleClick(event:ListEvent):void {
        var s:Object = event.itemRenderer.data['name']; // dataProvider is a mx:Model in XML form and there is a <name> sub element under <prof>
        Alert.show(event.rowIndex + " clicked "+s['last']); // I can access the String content in <last>
        // How do I access all the RadioButton in the DataGrid? I do not have a key
        // (event.itemRenderer.data['Selection'] as RadioButton).selected = true; this is NOT working as 'Selection' is just a Column title, not a key.
        // the RadioButton id 'rb' is also NOT working: rb[event.rowIndex].selected = true;
<?xml version="1.0"?>
<department>
  <prof>
    <name>
      <first>Mike</first>
      <last>Smith</last>
    </name>
   </prof>
</department>
I also tried a RadioButtonGroup for all the RadioButton's in different rows, but it does not work.
Thanks for any suggestions...

For these kinds of things, I separate the code out more. You could create another object where you create all your radio buttons as the DataGrid needs them. Add a method to the Object that allows you to retrieve the correct radio button from the List and then set it as selected or not selected based on what row you have identified that should change.
I do this with DataGroups a lot. For instance, if I have a scroller where I have a bunch of items that have custom renderers, I build all custom items individually in AS (or MXML and AS), store them in ArrayLists and then I tell the object that created them to update them whenever I need to. This will cause for some more coding, but it solves the problem and once you've done it once, you should be able to reuse.
Here is an example of an item renderer where I do what you are trying to do:
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx"
                autoDrawBackground="true">
    <fx:Script>
        <![CDATA[
            private var isChecked:Boolean = false;
            private var imageHeight:uint = 75;
            private var imageWidth:uint = 100;
            private var videoID:String;
            private var cbLabel:String;
            public function getIsChecked():Boolean {
                return isChecked;
             * You can use this if need to from outside. This
             * object also checks and unchecks itself.
            public function setIsChecked(isChecked:Boolean):void {
                this.isChecked = isChecked;
                fcvCheckBox.selected = isChecked;               
            public function setVidImage(vidImage:Image):void {
                vidImage.height = getImageHeight();
                vidImage.width = getImageWidth();
            public function getImageHeight():uint {
                return imageHeight;
            public function getImageWidth():uint {
                return imageWidth;
            public function setVideoID(videoID:String):void {
                this.videoID = videoID;
            public function getVideoID():String {
                return videoID;
            public function setCBLabel(cbLabel:String):void {
                this.cbLabel = cbLabel;
                fcvCheckBox.label = cbLabel;
            public function getCBLabel():String {
                return cbLabel;
            public function setVidTitle(vidTitle:String):void {
                fcvVidTitle.text = vidTitle;
                fcvVidTitle.toolTip = vidTitle;
            public function setVidDescription(vidDescript:String):void {
                fcvVidDescript.text = vidDescript;
                fcvVidDescript.toolTip = vidDescript;
            private function updateChecked():void {
                this.isChecked = fcvCheckBox.selected;
        ]]>
    </fx:Script>
    <s:HGroup>
        <mx:Image id="fcvVidImage"
                   height="{getImageHeight()}"
                   width="{getImageWidth()}"/>
        <s:Label id="fcvVidTitle"
                 text=""
                 width = "80"/>
        <s:TextArea id="fcvVidDescript"
                    editable="false"
                    width="80"
                    height="{getImageHeight()}"
                    />
        <s:CheckBox id="fcvCheckBox"
                    label="{getCBLabel()}"
                    click="{updateChecked()}"/>
    </s:HGroup>
</s:ItemRenderer>
Here is me adding the renderer to a Scroller:
        public function setPanelData(panelData:ArrayList,
                                     checkBoxLabel:String                                    
                                     ):FeedConfigVideoScroller{           
            videoScroller = new FeedConfigVideoScroller();
            for(var i:uint = 0; i < panelData.length; i++) {
                var o:Object = panelData.getItemAt(i);
                var videoID:String = String(o.videoId);
                var videoTitle:String = String (o.videoTitle);
                var videoDescript:String = String(o.descript);
                var posterURL:String = String(o.posterURL);
                var fcvLayout:FeedConfigVidLayout = new FeedConfigVidLayout();
                fcvLayout.setVideoID(videoID);
                var image:Image = new Image();
                image.source = posterURL;
                fcvLayout.setVidImage(image);
                fcvLayout.setCBLabel(checkBoxLabel);
                fcvLayout.setIsChecked(false);
                fcvLayout.setVidTitle(videoTitle);
                fcvLayout.setVidDescription(videoDescript);
                videoScroller.addFCVLayoutComp(fcvLayout);
            return videoScroller;
Now, because I've used OO and I've added all renderers to an ArrayList, I can get down to the individual components any time I like and do anything to them that I want.

Similar Messages

  • Find the itemRenderer components in Datagrid

    Hi,
    I have defined my itemRenderer for a DataGrid with different
    components like Checkbox, button etc according to the input.
    I would like to access the components from the application
    like dg.chkbox.
    Is it possible to do that??
    Thanks in advance...

    Hi John,
    I think u can not access directly
    .but through itemRollOver event of datagrid u can access the
    item renderer of particular column.
    I think It will help you.
    Megha

  • How can i access the stepname within a steps post-expression?

    How can i access the stepname within a steps post-expression?
    i only saw the step-id of the step: Step.TS.Id
    is there a pssibility to get the stepname from the id?
    thank you!

    Hi Fischer,
    use the expression NameOf(Step).
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Need info on Accessing portal services within a Web Dynpro application

    Hi,
    I need information on Accessing portal services within a Web Dynpro application.I want to explore this topic.Can anyone give useful links?
    Thanks in advance.
    Rajani N

    Hi
    how to reference  a portal service with web dyn pro ?
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/ep/how%20to/how%20to%20access%20a%20portal%20service%20within%20a%20web%20dynpro%20java%20application.pdf
    http://help.sap.com/javadocs/NW04S/current/wd/com/sap/tc/webdynpro/clientserver/portal/WDPortalUtils.html
    Best Regards
    Jakub Krecicki

  • IPAD3/IPAD2 :PDF files/ attachments  sent in an email  displayed inline ( embedded within the main email) in the message text on both my Ipad2 and Ipad three, however the same email displayed the PDF File icons/ attachment on both my Iphone and a friend's

    IPAD3/IPAD2 :PDF files/ attachments  sent in an email  displayed inline ( embedded within the main email) in the message text on both my Ipad2 and Ipad three, however the same email displayed the PDF File icons/ attachment on both my Iphone and a friend’s PC. How do i get both my IPAD devices to display the PDF icons/attachments? Bearing in mind if i open the same email over the internet the PDF Icons/attachments display OK!
    Has anyone come across this? Your advice/help would be most appreciated

    This happens to me all the time.
    If is a one page PDF it seems as though it comes over already open and inline in the body of the email. Multiple page PDF files show as the PDF icon.
    I can't find any official documentation of this - other than based on my own experience with PDF attachments in my various email accounts.
    Message was edited by: Demo

  • ItemRenderer in a datagrid column   setStyle() does not do anything to the appearance

    I have a custom ItemRenderer in a datagrid column, however
    the setStyle() does not do anything to the appearance. when it is
    called. Any ideas?
    <mx:DataGridColumn dataField="area" width="50"
    headerText="Area">
    <mx:itemRenderer>
    <mx:Component>
    <mx:Text>
    <mx:Script>
    <![CDATA[
    override public function set data( value:Object ) : void {
    super.data = value;
    setStyle("Color",0xff0000);
    if(data.area == 'G'){
    setStyle("backgroundColor",0xff0000);
    }else{
    setStyle("backgroundColor",0xff0000);
    ]]>
    </mx:Script>
    </mx:Text>
    </mx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>

    Your renderer code looks a little strange. This works, and
    may get you started:

  • The itemRenderer CheckBox of Datagrid displays incorrect sometime.

    The itemRenderer CheckBox of Datagrid displays incorrect
    sometime.
    A datagrid has a column:
    <mx:DataGridColumn headerText="selectMe" editable="true"
    dataField="_selected" itemRenderer="{new
    ClassFactory(mx.controls.CheckBox)}"
    rendererIsEditor="true" editorDataField="selected"/>
    There are serveral records which have been get from database.
    the records all are unchecked. after I checked some records , then
    refresh the data from database, the checkBoxs will display
    incorrect sometimes.
    any suggestion?
    thanks.

    It occured frequently. What can I do?

  • I am unable to access Bridge CS6 within Photoshop CS6

    I am unable to access Bridge CS6 within Photoshop CS6 using the File menu>Browse in Bridge. Instead, I receive an error message stating that "Bridge CS6 was not found on this system.  To use this command, please reinstall Bridge CS6".  Also, Mini Bridge fails to connect with Bridge CS6. Any suggestions?  I'm using Mac Operating System 10.6.8

    Hi Pragya,
    I uninstalled and reinstalled Photoshop CS6 and the problem has not been solved.  The only way I am able to open Bridge is through its own application folder. Once I'm in Bridge, I can access Photoshop CS6 by going to the file menu and choosing  Open With > Photoshop CS6. Bridge seems to be able to comminicate with Photoshop CS6 but Photoshop CS6 is unable to recognize or find Bridge CS6.  Any other suggests? Thank you.
    Regards
    Tzoel

  • Accessing Essbase cubes within a HP application using Essbase add-in

    Hi All,
    I've been told in the past by Oracle Support personnel that accessing the Essbase cubes within a Planning application using the MS Excel Essbase add-in is "a very bad idea" and that such an approach "is not supported\recommended by Oracle due to potential issues" (which the support person could not tell me about).
    Unfortunately, I have not found any information in the Planning documentation which supports or not this recommendation.
    As such:
    1. Could anyone point me in the right direction in terms of finding out whether it is recommended\supported (or not) for users to access Essbase cubes within a Planning application using the Essbase add-in?
    2. Has anyone ever experienced issues accessing Essbase cubes within a Planning application using the MS Excel Essbase add-in? If yes, what were these issues??
    PS: We are on v9.3.1.x of Essbase\Planning and will be moving over to v11.1.2.x in the next 6-8 months.
    Thanks in advance,
    JBM

    Hi Rob,
    Thank you for your prompt & informative response.
    On the topic of metadata, I am aware of what happens when changes are made directly to an Essbase outline which falls under a Planning application without going following the proper method ... and I agree that it ain't pretty! :-)
    On the topic of locking\sending data to the Essbase cubes within a Planning application, I also understand that it works quite well in as much as the data is saved in the appropriate intersections within the Essbase cube, as permitted by the security assigned to the user.
    I was more interested in whether such a practice of locking\sending data directly to Essbase cubes within a Planning application was actually encouraged or discouraged by Oracle.
    And please correct me if I am wrong but from what you are saying, it seems to me that it is neither as:
    - on one hand, the "Essbase Write" HSS feature allows administrators to create security groups and assign this type of provisioning to security groups in question;
    - on the other hand, Oracle Support seems to be verbally discouraging such a practice for no real reasons related to technological limitations;
    The problem that I have is that because some users at our site know that they can lock\send data to Essbase cubes within a Planning application and as a result, not only want to get us to grant similar lock\send access to other users but are now more reticent than ever to move away from the Essbase add-in as a means to load\submit data to a Planning application. And that's why I was after some formal recommendation from Oracle as to whether it is a recommended practice or not.
    Anyway, any suggestions would be much appreciated.
    Regards,
    JBM

  • How do you access attachments embedded within survey results?

    How do you access attachments embedded within survey results?

    This is a tutorial explaining attachments:
    http://forums.adobe.com/docs/DOC-2656

  • Can free online books be downloaded to memory of ipad2 so that book can be accessed when not within wi-fi range

    can free online books be downloaded to memory of ipad2 so that book can be accessed when not within wi-fi range

    It depends on what books you're referring to. All books from the iTunes Store are downloaded to your iPad and except for any special features the book may contain that requires an Internet connection will be readable without such a connection.
    If you're talking about books from some other source, we'd need to know the source before we could offer opinions.
    Regards.

  • How To Update Custom ItemRenderer (Image) on DataGrid Edit

    I have an DataGrid with 2 columns, column 1 called "Name" and column 2 called "Actions".
    The "Name" column contains editable text and the "Actions" column uses a (inline) custom ItemRenderer which displays 2 icon images ( for Edit and Delete). All works fine. Clicking Edit or Delete calls the corrosponding outerDocument method.
    The feature I am trying to add is as follows: when someone double-clicks on the text in the Name column to edit it, I would like the edit icon in the Actions column to ( grow/shrink, change color  - or some such indication/reminder to click it ). Not seeing how to do this with the inline ItemRenderer, I created a custom item renderer class and, in that class, use mx:Resize to perform the "grow/shrink". I created a method called "pulse()" and, from within that renderer, all works well. ( for testing, I wired the icons click event to the pulse() method ). However, now I am not sure how to call that ItemRenderers "pulse()" method to perform the effect from the main DataGrid (when the user double-clicks on Name field to edit).
    The tried using the DataGrid's "itemEditBegin", which fires correctly, but from that point I am not sure how to access the selected rows edit icon in the "Action" column. ( to call its pulse() ) method.
    So any suggestions how I can achieve my end result? Being able to manipulate the edit icon in the "Actions" column, when the user double-clicks (edits) that row's "Name" column?
    If I'm going about it all wrong, feel free to offer alternative solutions.
    Any help would be appreciated.
    Thanks,
    ~e

    Hi,
      Check the  BAPI_MATERIAL_SAVEDATA ,in the BAPI  is there a table parameter EXTENSIONIN ?
    which you can use to pass the values for user defined fields to the BAPI..
    Regards
    Kiran Sure

  • Problem with Checkbox ItemRenderer in a DataGrid

    Hello Everyone,
    I'm using a datagrid with two columns, which is used as a data entry grid. The first column has a simple text input field and the 2nd column has a checkbox as an itemrenderer. On creationComplete event, I'm passing an arraycollection as the dataprovider for this datagrid. The arraycollection:
    <mx:ArrayCollection id="psAC">
            <mx:source>
                <mx:Array>
                    <mx:Object PaText="line1" PaCheckbox="0" />
                    <mx:Object PaText="line2" PaCheckbox="0" />
                    <mx:Object PaText="line3" PaCheckbox="1" />
                    <mx:Object PaText="line4" PaCheckbox="0" />
                    <mx:Object PaText="line5" PaCheckbox="0" />
                </mx:Array>
            </mx:source>
        </mx:ArrayCollection>
    There is a datagrid (dGa) in the main application. On click of this, a pop up window comes up which has the same datagrid layout(i.e, 2 columns). And this is where the data is entered. Here, if the user checks the check box, I have assigned a value of '1' for the 2nd column of the arraycollection. THis code(below) works fine.
    <datagrid in pop up window>
    <mx:DataGridColumn headerText="Best Possible Action?" textAlign="center" width="200" editable="false">
                                <mx:itemRenderer>
                                    <mx:Component>
                                       <mx:CheckBox>
                                            <mx:Script>
                                                    <![CDATA[
                                                         override public function set data(value:Object):void{
                                                             if(value.PaCheckbox == 1){
                                                                this.selected = true;
                                                            }else{
                                                                this.selected = false;
                                                    ]]>
                                                </mx:Script>
                                            <!--<mx:change>
                                                <![CDATA[
                                                    if(this.selected == true){
                                                         data.PaCheckbox = 1;
                                                     }else{
                                                         data.PaCheckbox = 0;
                                                ]]>
                                            </mx:change>-->
                                        </mx:CheckBox>
                                    </mx:Component>
                                </mx:itemRenderer>
                            </mx:DataGridColumn>
    But I would also need to set the PaCheckbox value to 0 or 1, based on teh check condition of the check box. I tried using change event (commented in the code above). But there I get an error: Cannot access a property or method of a null object reference. I checekd in debug mode, there the data object is null! Can you please help me on how to pass back the values(0 o 1) to my arraycollection, based on the checkbox's status?
    Cheers,
    Deepak

    heyo,
    I solved it.....
    i was missing this line of code super.data = value; in the ovverriden function...Once we have this line, the data object will have teh field names and their values in it, which can be accessed on the change event...

  • ItemRenderer Issue with DataGrid and Label

    <mx:DataGrid width="100%" height="100%" rowCount="5" dataProvider="{publish_status}">
         <mx:columns>
              <mx:DataGridColumn dataField="status" headerText="Status">
                   <mx:itemRenderer>                        
                        <fx:Component>
                             <mx:Label text="{data.status}" fontSize="12">
                                  <fx:Script>
                                       <![CDATA[
                                       override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
                                       super.updateDisplayList(unscaledWidth, unscaledHeight);
                                       if(this.text == "A"){
                                            setStyle("color", "blue");
                                       else if(this.text == "B"){
                                                 setStyle("color", "green");
                                       else if(this.text == "C"){
                                            setStyle("color", "red");
                                       else{
                                            setStyle("color","white");
                                       ]]>
                                  </fx:Script>
                             </mx:Label>                                            
                        </fx:Component>                             
                   </mx:itemRenderer>
              </mx:DataGridColumn>
         </mx:columns>
    </mx:DataGrid>
    I created an inline ItemRenderer as above. I understand that it gets recycled and have included the last "else" statement to return color to default if all tests fail.  The problem is that the text is still showing up in the wrong colors.  I have done a lot of reading on the forums but I can't figure out what I'm missing.
    Thanks.
    Btw, I am using Flash Builder 4.

    Hi ,
    Try changing the color in set data function override method instead of updateDisplayList override.
    override public function set data(value:Object):void
         if(this.text == A){
            setStyle(color, blue);
       else if(this.text == B){
            setStyle(color, green);
       else if(this.text == C){
            setStyle(color, red);
       else{
            setStyle(color,white);
    Thanks,
    Bhasker

  • Data Model damaged, Cannot connect to Access 2013 from within Excel 2013

    Hello,
    Recently I am not able to use PowerPivot for Excel 2013 and I cannot connect to my Access 2013 database tables from within Excel 2013. Whenever I try to click on a slicer in my Excel worksheet, it gives me the following error: "Excel was unable to load
    a necessary component. This component might have been damaged or deleted. Reinstall the client software or data source driver software for your database."
    I am using Microsoft Office Pro Plus 2013 on Windows 7, 64-bit version. I have tried reinstalling Microsoft SQL Compact Edition 2005 and reinstalling Office 2013. I have run out of ideas and am a loss what to do next ? 
    Can anyone help point in the right direction for a possible solution to this problem ??? 
    Would appreciate all help.
    Thank you.
    ~Maneesh
    The problem with being punctual is, there's nobody there to appreciate it !!!

    Hi
    This is the forum to discuss questions about apps for office develop. For your question is more about Excel, I will move this thread to the TechNet forum for
    Excel
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly
    can either share their knowledge or learn from your interaction with us.
    Thank you for your understanding.
    Best Regards
    Lan
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Cisco ASA 5505 - outside can't DHPC as router use same range

    Hi Im new to the ASA and is trying to setup at test net. The ASA is connected to my router on port zero using DHPC. (Or i guess its not as the router use the same ip range as ASA does inside). I tried to set a static IP in the same range (eg. 192.168

  • Hard Disk Replacement for Toshiba Portege R500-S5006X

    I have a Toshiba Portege R500-S5006X which is out of warranty. I would like to replace the hard disk. What hard disk should I purchase? What is the maximum capacity (size in GB), maximum RPM speed and size in inches I can use in this laptop? Will a S

  • Why is  Safari is crashing after upgrading to Lion?

    After upgading to Lion, Safari always crashes on start up.  Firefox is working fine.  I've tried a number of things from the forums but really just guessing.  20" iMac 2.16GHz Intel Core 2 Duo, 2.5GB memory, Lion 10.7.4 (11e53) Any suggestions based

  • Input check of report

    I have selection option parameter to choose the date range called so_dt. this field gets data from the table ztbl_name. Here is the common input check IF NOT ztbl_name[] IS INITIAL.     SELECT dt        INTO wa        FROM ztbl_name          UP TO 1

  • How to update spry tab on all pages?

    Hi, Hope someone can help me. I created a template and have been building new pages. I didn't make the spry tab an editable region. Since I'm adding more and more pages I'm adding tabs as drop downs from the spry tab. However the pages I already made