0 Replies Latest reply on Jul 17, 2007 10:35 PM by hylim

    Click on DatagridColumn

    hylim
      Hi,

      I have created a Dynamic data grid class which adds datagridcolumns dynamically based on certain inputs.
      My problem is, I'm trying to add an Event Listener to 1 of the columns, such that if I click on it, it will dispatch an Event.

      public class DynDataGrid extends DataGrid
      {
      public function DynDataGrid()
      {
      super();
      createDataGrid();
      }

      public function createDataGrid():void
      {
      var dgc: DataGridColumn;

      dgc = new DataGridColumn();
      dgc.addEventListener(MouseEvent.CLICK, clickHandler);

      ...... //Rest of the codes add columns to datagrid
      }

      public function clickHandler(e:Event):void
      {
      trace("clickHandler");
      dispatchEvent(new myEvent(MyEvent.ITEM, this.data) );
      }
      }

      However, I find that when I click on any cells of that column, my clickHandler is not being "fired".

      Is there anything wrong with my codes?

      Thank you,
      hy