MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Guide de l'utilisateur Page 115

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 256
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 114
Populate a DataGrid control 115
Populate a DataGrid control
In your application, you want the DataGrid control to display the titles of recent posts and
the dates they were posted.
1. In Source mode, enter the following dataProvider property (in bold) in the
<mx:DataGrid> tag:
<mx:DataGrid x="20" y="20" id="dgPosts" width="400"
dataProvider="{feedRequest.lastResult.rss.channel.item}">
You want the XML node named item to provide data to the DataGrid control. This node
is repeated in the XML, so it will be repeated in the DataGrid.
2. In the first <mx:DataGridColumn> tag, enter the following headerText and dataField
property values (in bold):
<mx:DataGridColumn headerText="Posts" dataField="title"/>
You want the first column in the DataGrid control to display the titles of the posts. You do
this by identifying the field in the XML that contains the title data, and then entering this
field as the value of the
dataField property. In the XML node specified in the
dataProvider property (item), the child node called title contains the information you
want.
3. In the second <mx:DataGridColumn> tag, enter the following headerText, dataField
and
width property values (in bold):
<mx:DataGridColumn headerText="Date" dataField="pubDate" width="150"/>
You want the second column in the DataGrid to display the dates of the posts. In this case,
the field that contains the data is called
pubDate.
4. Delete the third <mx:DataGridColumn> tag because you don’t need a third column.
Vue de la page 114
1 2 ... 110 111 112 113 114 115 116 117 118 119 120 ... 255 256

Commentaires sur ces manuels

Pas de commentaire