I created the DP and set it as the data source of AdvancedDataGrid.

DataProvider
------------------
[Bindable]
private var dpFlat:ArrayCollection = new ArrayCollection([
        {TaskName:"Project 1", PlannedStartDate:"12-01-2009",
PlannedEndDate:"02-03-2009", TaskId:1, ParentTaskId:1},
        {TaskName:"Task 1",        PlannedStartDate:"12-01-2009",
PlannedEndDate:"22-01-2009", TaskId:2, ParentTaskId:2},
        {TaskName:"Task 1.1",  PlannedStartDate:"12-01-2009",
PlannedEndDate:"18-01-2009", TaskId:3, ParentTaskId:3},
        {TaskName:"Task 1.2",  PlannedStartDate:"19-01-2009",
PlannedEndDate:"20-01-2009", TaskId:4, ParentTaskId:4},
        {TaskName:"Task 1.3",  PlannedStartDate:"21-01-2009",
PlannedEndDate:"22-01-2009", TaskId:5, ParentTaskId:5},
        {TaskName:"Task 2",         PlannedStartDate:"23-01-2009",
PlannedEndDate:"02-02-2009", TaskId:6, ParentTaskId:6},
        {TaskName:"Task 2.1", PlannedStartDate:"23-01-2009",
PlannedEndDate:"28-01-2009", TaskId:7, ParentTaskId:7},
        {TaskName:"Task 2.2", PlannedStartDate:"28-01-2009",
PlannedEndDate:"31-01-2009", TaskId:8, ParentTaskId:8},
        {TaskName:"Task 2.3", PlannedStartDate:"01-02-2009",
PlannedEndDate:"02-02-2009", TaskId:9, ParentTaskId:9},
        {TaskName:"Task 3",         PlannedStartDate:"03-02-2009",
PlannedEndDate:"02-03-2009", TaskId:10, ParentTaskId:10},
        {TaskName:"Task 3.1", PlannedStartDate:"03-02-2009",
PlannedEndDate:"23-02-2009", TaskId:11, ParentTaskId:11},
        {TaskName:"Task 3.2", PlannedStartDate:"23-02-2009",
PlannedEndDate:"26-02-2009", TaskId:12, ParentTaskId:12},
        {TaskName:"Task 3.3", PlannedStartDate:"27-02-2009",
PlannedEndDate:"02-03-2009", TaskId:13, ParentTaskId:13}]);

Grid
------


<mx:AdvancedDataGrid id="myADG" width="100%" height="100%"
initialize="gc.refresh();">
        <mx:dataProvider>
                <mx:GroupingCollection id="gc" source="{dpFlat}">
                        <mx:grouping>
                                <mx:Grouping>
                                        <mx:GroupingField name="TaskName"/>
                                </mx:Grouping>
                        </mx:grouping>
                </mx:GroupingCollection>
        </mx:dataProvider>

        <mx:columns>
                <mx:AdvancedDataGridColumn dataField="TaskName" headerText="Task
Name"/>
                <mx:AdvancedDataGridColumn dataField="PlannedStartDate"
headerText="StartDate"/>
                <mx:AdvancedDataGridColumn dataField="PlannedEndDate"
headerText="EndDate"/>
                <mx:AdvancedDataGridColumn dataField="TaskId" 
headerText="TaskId"/>
                <mx:AdvancedDataGridColumn dataField="ParentTaskId"
headerText="ParentTaskId"/>
                </mx:columns>
        </mx:AdvancedDataGrid>


But while displaying the output is,

[-]Project 1
  Project 1     12-01-2009      02-03-2009      1       0

[-]Task 1
  Task 1        12-01-2009      22-01-2009      2       1

[-]Task 1.1
  Task 1.1      12-01-2009      18-01-2009      3       2

[-]Task 1.2
  Task 1.2      19-01-2009      20-01-2009      4       2

[-]Task 1.3
  Task 1.3      21-01-2009      22-01-2009      5       2

[-]Task 2
  Task 2        23-01-2009      02-02-2009      6       1

[-]Task 2.1
  Task 2.1      23-01-2009      28-01-2009      7       6

[-]Task 2.2
  Task 2.2      28-01-2009      31-01-2009      8       6

[-]Task 2.3
  Task 2.3      01-02-2009      02-02-2009      9       6

[-]Task 3
  Task 3        03-02-2009      02-03-2009      10      1

[-]Task 3.1
  Task 3.1      03-02-2009      23-02-2009      11      10

[-]Task 3.3
  task 3.2      23-02-2009      26-02-2009      12      10

[-]Task 3.31
  Task 3.3      27-02-2009      02-03-2009      13      10


HOW TO CHANGE THIS IN TO THE BELOW FORMAT

[-]Project 1    12-01-2009      02-03-2009      1       0

   [-]Task 1            12-01-2009      22-01-2009      2       1

      [-]Task 1.1       12-01-2009      18-01-2009      3       2

      [-]Task 1.2       19-01-2009      20-01-2009      4       2

      [-]Task 1.3       21-01-2009      22-01-2009      5       2

   [-]Task 2            23-01-2009      02-02-2009      6       1

      [-]Task 2.1       23-01-2009      28-01-2009      7       6

      [-]Task 2.2       28-01-2009      31-01-2009      8       6

      [-]Task 2.3       01-02-2009      02-02-2009      9       6

   [-]Task 3            03-02-2009      02-03-2009      10      1

      [-]Task 3.1       03-02-2009      23-02-2009      11      10

      [-]Task 3.3       23-02-2009      26-02-2009      12      10

      [-]Task 3.3       27-02-2009      02-03-2009      13      10

On Jun 25, 2:10 pm, xelf <samjayan...@gmail.com> wrote:
> Hi,
> For getting the tree structure you have to create DP for the advanced
> datagrid like that.
> Either you need to have an array collection restructured or in xml
> format... You need to convert to HierarchialData and then give it as
> Dp for AdvDatagrid.
>
> For 
> referencehttp://livedocs.adobe.com/flex/3/html/help.html?content=Part2_adv_dat...
> see the topic  'Hierarchical and grouped data display '.....
>
> I hope this will help you...
>
> Sam
>
> On Jun 25, 1:38 pm, lalji <prajilal...@gmail.com> wrote:
>
>
>
> > I have a list of data same as following
>
> > #       Task Name               StartDate         EndDate               
> > ParentTaskId
> > ---------------------------------------------------------------------------­--------------------------------
> > 1       Project 1                      12-01-2009               02-03-2009  
> >     0
>
> > 2       Documentation           12-01-2009      22-01-2009      1
> > 3       DOC-Preparation 12-01-2009      18-01-2009      2
> > 4       DOC-Review              19-01-2009      20-01-2009      2
> > 5       DOC-Rework              21-01-2009      22-01-2009      2
>
> > 6       Design                  23-01-2009      02-02-2009      1
> > 7       DES-Preparation 23-01-2009      28-01-2009      6
> > 8       DES-Review              28-01-2009      31-01-2009      6
> > 9       DES-Rework              01-02-2009      02-02-2009      6
>
> > 10      Coding                  03-02-2009      02-03-2009      1
> > 11      COD-Preparation 03-02-2009      23-02-2009      10
> > 12      COD-Review              23-02-2009      26-02-2009      10
> > 13      COD-Rework              27-02-2009      02-03-2009      10
>
> > I want to display this in to advanced datagrid.. w.r.to parent task
> > Id..
>
> > [-]Project1
> >         [-] Documentation
> >                 DOC-Preparation
> >                 DOC-Review
> >                 DOC-Rework
> >         [-] Design
> >                 DES-Preparation
> >                 DES-Review
> >                 DES-Rework
> >         [+] Coding
>
> > ie;, Project1 is the first row...
> > When expanding project!1 it should display the other rows whose parent
> > taskId is 0(Project1's serial No).
>
> > Thanks in advance
> >  lalji- Hide quoted text -
>
> - Show quoted text -

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

Reply via email to