4 Replies Latest reply on Jun 23, 2009 12:38 AM by DM277

    General labelFunction question

    istrasci Level 1

      My question about labelFunctions is, what actually fires them...?  I have a dataGrid that uses a labelFunction.  The function includes some variable s' object-dependencies depending on the column.  Here's a code snippet:

       

      private function gridLabel(item:myClass, col:DataGridColumn):String

      {

      if (col == licNoCol)
           return item.licLicense.licenseNumber;
      else if (col == nameCol)
           return (item.licLicense.licPerson.lastName + ", " + item.licLicense.licPerson.firstName);


      ... etc, etc.

      }

       

      Now, when I populate the grid, it calls the function just fine to display the correct text in the correct columns.  But after a certain operation (a mysql database save -- using RestfulX framework for anyone else who might be using it), somehow the labelFunction fires again.  During this time, the item.licLicense reference is null, so I get a null-reference exception.  Why the reference is null is one question and maybe something wrong with my own logic, but my bigger concern is Why is the labelFunction firing again???  What is a possible cause of this??  Is there any way I can supress it so that I don't get this runtime error??

       

      Any help is greatly appreciated!  Thank you.