Hi,

I am new to flex and have been facing a problem of grouping on
Advanced DataGrid. I want to read the XML file from an external source
and show that in the Advanced DataGrid form with a grouping on the
first two columns . The problem is that if i am embedding the XML file
in the code itself,then it is working fine. But if i am getting the
data from an XML file then it is showing no data if i have grouped it
on the two columns. But if i remove the grouping then it is working
fine and showing correct ungrouped data in the advanced datagrid.Here
is the code :

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
creationComplete="http_srv.send()">
<mx:Script>
<![CDATA[
        import mx.rpc.events.ResultEvent;
import mx.collections.ArrayCollection;
[Bindable]
private var dpFlat:ArrayCollection;

private function dpHandler(evt:ResultEvent):void
{
        dpFlat=evt.result.books.stock;

}

]]>
</mx:Script>
<mx:HTTPService id="http_srv" url="H:/Flex WorkSpace/Samples/
books.xml" result="dpHandler(event)"/>
<mx:AdvancedDataGrid id="myADG" width="100%" height="100%"
defaultLeafIcon="{null}" initialize="gc.refresh();">
<mx:dataProvider>
<mx:GroupingCollection id="gc" source="{dpFlat}">
<mx:Grouping>
<mx:GroupingField name="category"/>
</mx:Grouping>
</mx:GroupingCollection>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="category"
headerText="Genre"/>
<mx:AdvancedDataGridColumn dataField="name"
headerText="Book"/>
<mx:AdvancedDataGridColumn dataField="author" headerText="Author"/>
<mx:AdvancedDataGridColumn dataField="description"
headerText="Description"/>
</mx:columns>
</mx:AdvancedDataGrid>
</mx:Application>

The XML file is as follows :

 <?xml version="1.0" encoding="iso-8859-1" ?>
- <books>
- <stock>
  <name>The Picasso Code</name>
  <author>Dan Blue</author>
  <category>Fiction</category>
  <description>Cubist paintings reveal a secret society of people who
really look like that</description>
  </stock>
- <stock>
  <name>Here With the Wind</name>
  <author>Margaret Middle</author>
  <category>Fiction</category>
  <description>In this edition, nobody in the south really gives a
damn</description>
  </stock>
 </books>

Any help in this regard would be highly appreciated.

Thanks,
Shishir.

PS: How do i attach some documents here ?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to