FLUGR
FLUGR Forums
Forums | Profile | Inbox | Members | Search | Login | RSS
New Topic Reply Subscription Options   Previous Page  Page: 1   Previous Page

Forums: Flex: Hierachical Data xml
Created on: 09/20/08 08:01 AM Views: 435 Replies: 1
Hierachical Data xml
Posted Saturday, September 20, 2008 at 8:01 AM

I have the following xml

<companies>
<company>
<name>Jansen BV</name>
<departments>
<department>Accounting</department>
<department>Sales</department>
<department>Management</department>
</departments>
</company>
<company>
<name>Pietersen BV</name>
<departments>
<department>Storage</department>
<department>HRM</department>
<department>Call Center</department>
</departments>
</company>
</companies>

Now what I would like to have are 2 datagrids on one page. One with only the company names in it. (that one is no problem)

The second datagrid is ! I like to have all departments in this datagrid. So of both companies all deparments.

I don't know how. What I do know is that I would like to use the same xml array for this, so that I don't have to load this xml twice.

Thanxs !

Theo

To bodly go where no one has gone before.... http://www.vandersluijs.nl

www
RE: Hierachical Data xml
Posted Wednesday, July 8, 2009 at 9:00 PM

Is it possible to modify the xml so the department-tag looks like this?


<department>
<name>departmentName</name>
</department>

If so, you could do it like I did in this example


<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">
   <mx:XML id="companiesXml" source="xml/companies.xml" />

   <mx:XMLListCollection id="companyXmlList"
      source="{companiesXml.company}" />

   
   <mx:XMLListCollection id="departmentXmlList"
      source="{companiesXml.company.departments.department}" />

   
   <mx:DataGrid id="dgCompanies"
      dataProvider="{companyXmlList}">

      <mx:columns>
         <mx:DataGridColumn dataField="name" />
      </mx:columns>
   </mx:DataGrid>
   <mx:DataGrid id="dgDepartments"
      dataProvider="{departmentXmlList}">

      <mx:columns>
         <mx:DataGridColumn dataField="name" />
      </mx:columns>
   </mx:DataGrid>
</mx:Application>

Hope this helps you out.

Best regards,

Jurgen

Visit http://www.jscoop.eu for information about low-cost Java and Flex training!

www email

New Topic Reply Subscription Options   Previous Page  Page: 1   Previous Page
Subscription Options
Subscription options are available after you log in.

There are 3 active user sessions right now.