3 Replies Latest reply on Jul 20, 2006 10:05 AM by smgilson

    Calling a function from an itemRenderer

    ekokurtz Level 1
      This is probably easy, but can't find documentation to do it the first time. When using a datagrid with column containign a checkbox, how do you call a function with the click event of the checkbox?

      Here is my code, but I get '1180: Call to a possibly undefined method checkDiscounts.'

      <mx:DataGrid showHeaders="false" color="0x000000" x="23" y="9" id="discountGrid" height="114" width="275" editable="true" backgroundAlpha="1" alternatingItemColors="[0xffffff,0xededed]" themeColor="0x999999">
      <mx:dataProvider >
      <mx:ArrayCollection id="discountArray">
      <mx:source>
      <mx:Object discountPrcnt=".91" discountName="Discount 1" useDiscount="true"/>
      <mx:Object discountPrcnt=".92" discountName="Discount 2" useDiscount="false"/>
      <mx:Object discountPrcnt=".93" discountName="Discount 3" useDiscount="true"/>
      <mx:Object discountPrcnt=".94" discountName="Discount 4" useDiscount="true"/>
      <mx:Object discountPrcnt=".95" discountName="Discount 5" useDiscount="false"/>
      <mx:Object discountPrcnt=".96" discountName="Discount 5" useDiscount="false"/>
      </mx:source>
      </mx:ArrayCollection>
      </mx:dataProvider>

      <mx:columns>
      <mx:Array>
      <mx:DataGridColumn dataField="discountName" textAlign="left"/>
      <mx:DataGridColumn dataField="discountPrcnt" textAlign="left"/>
      <mx:DataGridColumn dataField="useDiscount" rendererIsEditor="true" editorDataField="selected" width="15">
      <mx:itemRenderer >
      <mx:Component className="discountCheck" >
      <mx:CheckBox click="checkDiscounts();"/>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>

      </mx:Array>
      </mx:columns>
      </mx:DataGrid>