3 Replies Latest reply on Nov 25, 2009 1:36 AM by manishmulani

    about data object


      Hello everyone,


      I'm somewhat new to flex. I've this doubt since many days.


      I've seen this


      for eg: DataGridColumn dataField="{data.something}"


      in many places. what is data here ?? It's not defined anywhere. Is it some default which points to source of the data.

      Please clarify.


      I also tried this.


      <mx:DataGrid dataProvider="{myXML.books}">


           <mx:DataGridColumn dataField="{data.book}"/>




      but this doesn't work as expected. (Assuming I've this XML <books><book>hello</book><book>wow</book></books>)


      Please help




        • 1. Re: about data object
          paul.williams Level 4

          I think you may have seen something like this:


              dataField="image" headerText="Image"
                                      width="100%" height="140"
                                      horizontalAlign="center" verticalAlign="middle">
                                          <mx:Image source="{'assets/'+data.image}"/>
                                          <mx:Label text="{data.image}" />

          In this case 'data' is a property of the item renderer. In order to be used as an item renderer, a component must expose a 'data' property.
          The 'data' property is populated with the relevant item from the dataProvider.


          The dataField property tells a column what property of a dataProvider item to display. So dataField="data" would tell the column to display the data property of the item. If your items don't have a "data" property then nothing will be displayed.


          This link may be helpful:



          • 2. Re: about data object
            msakrejda Level 4

            To follow up on Paul's response, for this example, try setting the dataField simply to 'book'.

            • 3. Re: about data object
              manishmulani Level 1

              Thank you for the help paul.williams