5 Replies Latest reply on May 12, 2009 6:55 AM by Muzak

    How to call a method from itemRenderer

    Mohd Fayaz Level 1

      Hi,

       

      I need to call a method on click of a HBox rendered within DataGrid. However, when I try to call the method on click property of HBox control, an error appears stating " Call to a possibly undefined method goToAlertTab." I have duely defined that method within <mx:Script> tag. Here is the sample code. Can anyone please tell me what is the problem?

       

       

                  <mx:DataGridColumn headerText="Alerts" dataField="alert">
                      <mx:itemRenderer>
                          <mx:Component>
                              <mx:HBox horizontalGap="2" horizontalAlign="center" click="goToAlertTab()">
                                  <mx:Canvas height="100%" backgroundColor="Red" alpha="0.8"
                                      width="{data.alert.critical}" toolTip="{'Critical :'+data.alert.critical}">
                                      <mx:Label text=""/>
                                  </mx:Canvas>
                                  <mx:Canvas height="100%" backgroundColor="0xff6600" width="{data.alert.error}" toolTip="{'Error:'+data.alert.error}">
                                      <mx:Label text=""/>
                                  </mx:Canvas>
                                 
                                  <mx:Canvas height="100%" backgroundColor="Yellow" alpha="0.8"
                                      width="{data.alert.warning}" toolTip="{'Warning:'+data.alert.warning}">
                                      <mx:Label text=""/>
                                  </mx:Canvas>
                                 
                              </mx:HBox>
                          </mx:Component>
                      </mx:itemRenderer>
                  </mx:DataGridColumn>