1 Reply Latest reply on Apr 30, 2007 9:41 AM by tanzy_m

    DataGrid and TitleWindow problem - clicking header calls TitleWindow!

    tanzy_m
      Hi all,

      I'm really stumped by this, any help would be greatly appreciated!

      I have a DataGrid and a TitleWindow. I've been using a "click" command in the DataGrid i.e. click="launchViewer(event)".

      This is the code for the launchViewer :
      public function launchViewer(event:MouseEvent):void
      { /* Function launchViewer */
      var popUp:ViewWindow = ViewWindow(PopUpManager.createPopUp(this, ViewWindow, false));
      }


      But now I find that if I click on the headers to sort the columns of the datagrid the TitleWindow gets called as well! Is there any way to recognise that if I click on a column header the TitleWindow function won't get called?

      I've tried using mouseOver but get this error:
      TypeError: Error #1009: Cannot access a property or method of a null object reference.

      Please help!
      Many thanks,
      Tanz
        • 1. Re: DataGrid and TitleWindow problem - clicking header calls TitleWindow!
          tanzy_m Level 1
          Here's a solution I found that worked for me:

          I used the call change="dgClicked(event)" instead of click="launchViewer(event)" in the Datagrid defintiion.

          The function dgClicked checks which row the cell clicked was in. If row 0 (the header) was the one clicked then do only normal sorting - ie don't call the TitleWindow popUp.

          public function dgClicked(event:ListEvent):void
          {
          if ( event.rowIndex != 0){
          launchViewer(event);
          }
          }

          Also the definition of launchViewer had to change from a MouseEvent to a ListEvent:
          public function launchViewer(event:ListEvent):void
          {
          var popUp:ViewWindow = ViewWindow(PopUpManager.createPopUp(this, ViewWindow, false));
          }


          Hope this helps someone else out!
          T.