Skip navigation
Currently Being Moderated

How to accessing item renderers in action script??

Jun 3, 2009 10:41 PM

Hi

I am working on itemrenderes in Flex!

I have link button component as item renderer inside one of the data grid column, please find my piece as below!

Now how do we make that item render invisible once we click on it!

We need to make that link button invisible to the user!

Let me know how to access like this!

public function onClick():void {

            // we use our custom component as the template for the popup window

            var confirmWindow:TitleWindow = TitleWindow(PopUpManager.createPopUp(this, ConfirmationPopUp, true));

            // you will only need to take care of the yes response since you don't have to do anything

            // if the response was a no

            confirmWindow.addEventListener("selectedYes", function():void {  

                        //Alert.show("Can be Upgraded to an Alarm");

                        upGradeEventToAnAlarm();

                                         

            });

            confirmWindow.addEventListener("selectedNo", function():void {         

            });

            }

        public function upGradeEventToAnAlarm():void

        {

            eventRO = new RemoteObject();                  

                  eventRO.destination = "eventBrowser";

                  eventRO.upGradeEventToAlarm.addEventListener("result",getResultHandler);                 

                  eventRO.addEventListener("fault", getFaultHandler);

                  eventRO.upGradeEventToAlarm(eventsDataGrid.selectedItem.id);

        }

       

        private function getResultHandler(event:ResultEvent):void

        {   

                  //eventsDataGrid.dataProvider.removeItemAt(eventsDataGrid.selectedInde x)

                  if(event.result == true)

                        {

                   Here I need to access the link button which is clicked and need to make invisible

Alert.show("Successfully  Upgraded to an alarm");

                        }

                  else

                        {

                        Alert.show("Cannot be Upgraded to an alarm");  

                        }    

                                                                                          

            }

            //Fault Handler.             

            private function getFaultHandler(event:FaultEvent):void 

            {                      

                  Alert.show(event.fault.faultString, 'Error');

            }

                       

            ]]>

</mx:Script>           

      <mx:TabNavigator x="24" y="25" width="95%" height="90%"

            styleName="MyTabNavigator" horizontalGap="-20"  backgroundColor="#e6e4e5">

            <mx:Canvas label="View" width="100%" height="100%" >

                  <mx:DataGrid id="eventsDataGrid" dataProvider="{myModel.eventsList}"

                         height="90%" width="98%" x="10" y="23" >

                  <mx:columns>

                  <!--  <mx:DataGridColumn  id="iconFlagID" headerText="IconFlag"

                              dataField="iconFlag" visible="false"/>-->

                        <mx:DataGridColumn  headerText="EventID" dataField="id" visible="false"/>

                        <mx:DataGridColumn  headerText="Event Name" dataField="eventName"/>

                        <mx:DataGridColumn  id="catFieldId" headerText="Category"

                              dataField="category"/>

                        <mx:DataGridColumn  headerText="AlarmName" dataField="alarmName"/>

                        <mx:DataGridColumn  headerText="Severity" dataField="severity"/>

                        <mx:DataGridColumn  headerText="Source" dataField="source"/>

                        <mx:DataGridColumn  headerText="Updated Time" dataField="updateTime"/>

                        <mx:DataGridColumn  headerText="Description" dataField="description"/>

                        <mx:DataGridColumn  id="upgradeLinkButtonId

                              headerText="Upgrade To Alarm" dataField="iconFlag">                          

                        <mx:itemRenderer>

                        <mx:Component>

                <mx:Box height="100%" width="100%">               

                <mx:LinkButton id="eventsLinkButtonID" textDecoration="underline"

                              icon="@Embed(source='assets/eventsBrowser/images[97]1.JPG')"

                              click="outerDocument.onClick();" visible="{!data.iconFlag}"

                              textAlign="center" includeInLayout="true">

                        

                </mx:LinkButton>                                       

                        </mx:Box>

                </mx:Component>

                </mx:itemRenderer>

                        </mx:DataGridColumn>

                  </mx:columns>    

                  </mx:DataGrid>

Thanks in advance

Aruna.S.N.

 
Replies
  • Currently Being Moderated
    Jun 12, 2009 2:47 PM   in reply to aruvasavi

    Here, try to use ViewStack like

    < ViewStack selectedIndex=0

         <LinkButton>

         <Label>

    <ViewStack >

     

    Once you will click on LinkButton, make selectedIndex for ViewStack to 1, which will hide LinkButton & will Show blank Label.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points