Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataProvider many-in-many XML

Status
Not open for further replies.

Triion

Programmer
Sep 20, 2005
6
BE
Hi,

This may be a newbie question, but here goes:
My XML is something like this:
Code:
<persons>
   <person>
      <name>XXX</name>
      <phones>
         <phone>yyy</phone>
         <phone>zzz</phone>
      </phones>
   </person>
   <person>
     ...
   </person>
</persons>
Now the question is, how can I make a datagrid with all the info and name, phone1, phone2 and phone3 as columns?

Now I have something like this is flex:
Code:
<mx:XML id="mydata" source="[URL unfurl="true"]http://localhost/retrievePersons.php"></mx:XML>[/URL]
	<mx:TabNavigator x="20" y="20" width="700" height="300">
		<mx:Canvas label="Persons" width="700" height="250">
			<mx:DataGrid x="10" y="10" width="240" dataProvider="{mydata..person}">
				<mx:columns>
					<mx:DataGridColumn headerText="Name" dataField="name" width="160"/>
					<mx:DataGridColumn headerText="Phone1" [b]dataField="phone"[/b] width="40"/>
					<mx:DataGridColumn headerText="Phone2" [b]dataField="phone"[/b] width="40"/>
				</mx:columns>
			</mx:DataGrid>
		</mx:Canvas>
The problem is obviously the multiple phones... I've tried putting {phones.phone} in the dataField and other tests, but no result... On the 2 lasts columns, the dataProvider should be {mydata..person..phone} I think, but how do I do this? (Can't change the xml)
Any suggestions? How can you modify the dataField to skip an other child in the XML?

Thanks in advance !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top