1 Reply Latest reply on Jan 17, 2008 8:20 PM by atta707

    itemRenderer in DataGridColumn

    Alberto_Mz
      Hi, I wonder if i have something like this:

      <mx:DataGridColumn dataField="VALUE" headerText="Column 1" itemRenderer="mx.controls.CheckBox" rendererIsEditor="true" editorDataField="selected" />

      can i use the itemRenderer events, in this case the events of a CheckBox, i want to use the click event.

      Thanks,
      Alberto
        • 1. Re: itemRenderer in DataGridColumn
          atta707 Level 2
          Yes, you can if you define the itemRenderer as inner elemnt of the column:

          <mx:DataGridColumn headerText="Email" dataField="email">
          <mx:itemRenderer>
          <mx:Component>
          <mx:CheckBox click="{outerDocument.dosomething();}"/>
          </mx:Component>
          </mx:itemRenderer>
          </mx:DataGridColumn>


          But i personally would like to create a new component based on the checkbox and use it as my item renderer. Just makes things easier to manage.

          <mx:DataGridColumn dataField="VALUE" headerText="Column 1" itemRenderer="my.package.ClickAwareCheckBox" rendererIsEditor="true" editorDataField="selected" />

          Now I will be handling any events in the ClickAwareCheckBox component. If you read on "Custom Item Renderers" you'll find quite a few examples in the docs.

          ATTA