datagrid and static dataprovider
I'm trying to get this code working, any help would be greatly appreciated.
<mx:DataGrid x="359" y="221" width="623" height="176">
<mx:dataProvider>
开发者_StackOverflow<fx:Object name="Garbage Collection" code="7777" hours="2"/>
<fx:Object name="Road Repair" code="8888" hours="6"/>
<fx:Object name="Lawn Maintenance" code="9999" hours="12"/>
</mx:dataProvider>
<mx:columns>
<mx:DataGridColumn headerText="Column 1" dataField="name"/>
<mx:DataGridColumn headerText="Column 2" dataField="code"/>
<mx:DataGridColumn headerText="Column 3" dataField="hours"/>
</mx:columns>
</mx:DataGrid>
I even don't have he header text in my columns ... I really don't understand.
Thank
Pierre
You don't need the <fx:Array>
regarding to Adobe: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/DataGrid.html?filter_flex=4.1&filter_flashplayer=10.1&filter_air=2
But it should also work with an array. Is the dataProvider attribut of your DataGrid set, when you debug your application?
<mx:DataGrid x="359" y="221" width="623" height="176">
<mx:dataProvider>
<fx:Object name="Garbage Collection" code="7777" hours="2"/>
<fx:Object name="Road Repair" code="8888" hours="6"/>
<fx:Object name="Lawn Maintenance" code="9999" hours="12"/>
</mx:dataProvider>
<mx:columns>
<mx:DataGridColumn headerText="Column 1" dataField="name"/>
<mx:DataGridColumn headerText="Column 2" dataField="code"/>
<mx:DataGridColumn headerText="Column 3" dataField="hours"/>
</mx:columns>
</mx:DataGrid>
Try wrapping your <fx:Object />
's in an Array:
<mx:dataProvider>
<mx:Array>
<fx:Object />
</mx:Array>
</mx:dataProvider>
精彩评论