Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-06-2010, 02:59 PM   #1
Join Date: Oct 2007
Location: wilmington, de
Posts: 1
Question datagrid problem

Im new to flex trying to run a simple test with some xml.
I cant get the data to display properly as everything is displaying on one line in the datagrid. Im sure there is an easy fix....
Thanks in advance for your help!

ActionScript Code:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top"                 horizontalAlign="center" paddingTop="0" > <mx:Model id="mydata">         <Report>             <ParametersInfo>             </ParametersInfo>             <ColumnInfo>                 <Column pos = "1" type = "VARCHAR2">EL_VALUES_FIELD8</Column>                 <Column pos = "2" type = "VARCHAR2">EL_VALUES_FIELD9</Column>             </ColumnInfo>             <Data>                 <Row>                     <Field name = "EL_VALUES_FIELD8" pos= "1">NAM</Field>                     <Field name = "EL_VALUES_FIELD9" pos= "2">United States</Field>                 </Row>             </Data>         </Report>     </mx:Model>                     <mx:Panel>     <mx:DataGrid dataProvider="{mydata}" width="500">         <mx:columns >             <mx:DataGridColumn  dataField="ColumnInfo.Column" headerText="Junk"/>             <mx:DataGridColumn dataField="Data.Row.Field" headerText="whatJunk"/>         </mx:columns>     </mx:DataGrid>         </mx:Panel> </mx:Application>
goflashman is offline   Reply With Quote
Old 03-07-2010, 11:42 PM   #2
drkstr's Avatar
Join Date: Sep 2006
Location: Seattle, WA: USA
Posts: 1,587

Any kind of list control (such as a DataGrid), need to bind to data that implements ICollectionView, or at least can act like one. This means you need "list" (Array, ArrayCollection, XMLList, etc) data and not Object data.

<mx:ArrayCollection id="mydata">
	<Object label="foo1" value="bar1"/>
	<Object label="foo2" value="bar2"/>
	<Object label="foo3" value="bar3"/>

<mx:DataGrid dataProvider="{mydata}" width="500">
		<mx:DataGridColumn dataField="label" headerText="Label"/>
		<mx:DataGridColumn dataField="value" headerText="Value"/>

drkstr is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 08:33 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.