2 Replies Latest reply on May 15, 2008 10:11 PM by anoweb

    Bind DataGridColumn "dataField" to property of an object?

    anoweb Level 1
      I have a model object say, "Person" that has one field "name" that is bindable.
      I have a DataGrid that displays a collection of Person objects:

      // load the people objects
      [Bindable]
      public var people : ArrayCollection = loadPeople();

      <mx:DataGrid dataProvider="{people}" ...>
      <mx:columns>
      <mx:DataGridColumn dataField="name" headerText="Persons Name" />
      </mx:columns>
      </mx:DataGrid>

      See how I just have "name" in the "dataField" for the column? I'd like to do something such as:
      <mx:DataGridColumn dataField="{Person.name}" .../>

      instead of hard coding the "name" text I'd like to bind to actual property on my model object. Is this possible? If so, how?