(can I use an Httpservice result directly as the dataprovider?)
I am just moving over to Flex 3 and want to use the AdvancedDataGrid and I
can't seem to
get it to read the lastResult of an HTTPService.
if I use dataProvider="{studXML.lastResult.student}" I get stuff in the grid
but it's not
hierarchical (no folder opening to see children nodes)
if I use dataProvider="{new HierarchicalData(studXML.lastResult.student)}" I
get no data in
the grid
I tried messing with the resultFormat of the HTTPService but nothing seems to
work (it
seems it has to be e4x just to get some data displayed)
Am I missing some new behavior with the AdvancedDataGrid? (code and data below)
I appreciate any clues. Thanks.
be well,
Hoyt
My Code:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="studXML.send();">
<mx:HTTPService id="studXML" resultFormat="e4x"
url="http://localhost/~hoytng/Workspace/studentDB/xml/student.xml"/>
<mx:AdvancedDataGrid dataProvider="{studXML.lastResult.student}" x="10"
y="306"
id="adg1" designViewDataType="tree" width="1004" height="452">
<mx:columns>
<mx:AdvancedDataGridColumn headerText="Student Name"
dataField="@studname"/>
<mx:AdvancedDataGridColumn headerText="Notes"
dataField="notes"/>
<mx:AdvancedDataGridColumn headerText="Curriculum"
dataField="@currid"/>
<mx:AdvancedDataGridColumn headerText="Class Name"
dataField="@klassname"/>
<mx:AdvancedDataGridColumn headerText="Date"
dataField="@date"/>
</mx:columns>
</mx:AdvancedDataGrid>
</mx:Application>
My Data:
<rwc>
<student studname="fred flintstone">
<notes><![CDATA[Can't feed his brontosaurus]]></notes>
<curriculum currid="1" currname="curricula B">
<class klassname="klass A" sched="no" take="no" date="" inst=""/>
<class klassname="klass B" sched="no" take="no" date="" inst=""/>
<class klassname="klass C" sched="no" take="no" date="" inst=""/>
<class klassname="klass D" sched="no" take="no" date="" inst=""/>
</curriculum>
</student>
<student studname="barney rubble">
<notes><![CDATA[This is about dinosaurs]]></notes>
<curriculum currid="2" currname="curricula A">
<class klassname="klass A" sched="yes" take="no" date="01252008"
inst="jim
jestson"/>
<class klassname="klass B" sched="yes" take="yes" date="01262008"
inst="bob
hope"/>
<class klassname="klass D" sched="no" take="no" date="02142008"
inst="mr
hooper"/>
<class klassname="klass F" sched="yes" take="no" date="02162008"
inst="mr
rogers"/>
</curriculum>
</student>
</rwc>