1 Reply Latest reply on Feb 27, 2009 8:26 AM by Handycam

    Label Function problem

    Handycam Level 1
      I currently have a datagrid displaying an XMLListCollection:
      <mx:DataGridColumn dataField="first_name" headerText="First Name" width="85"/>
      <mx:DataGridColumn dataField="last_name" headerText="Last Name" width="95"/>

      So I would rather have one column for "full name", so I did:
      <mx:DataGridColumn labelFunction="makeFullName" headerText="Last Name" width="95"/>

      and:

      public function makeFullName(item:Object):String {
      return item.first_name + " " + item.last_name;
      }

      But I when I run that, my whole datagrid fails and comes up empty. What did I miss here?
        • 1. Label Function problem
          Handycam Level 1
          Figured it out, I was using the format for a list, not a datagrid. I changed the function to

          public function makeFullName(item:Object, dataField:DataGridColumn):String {
          return item.first_name + " " + item.last_name;
          }

          works fine!