I am using Advanced Datagrid. I am using three buttons. Add
Task,AddSubTask,Delete Task.I am able to Add and Delete Task. I want to know
how is it possible to add subtasks like tree structure.That means selecting
a Task and adding Subtasks for that selected Task. Iam attaching the code
also.

Please help me

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">
    <mx:AdvancedDataGrid  id="TaskRole1Grid" editable="true"
designViewDataType="tree" allowMultipleSelection="true"
creationComplete="{initGrid()}" dataProvider="{taskCol}" x="122" y="61"
color="#09090A" height="50%" width="836">
                    <mx:columns>
                        <mx:AdvancedDataGridColumn editable="true"
headerText="Task" dataField="task" width="300"/>
                        <mx:AdvancedDataGridColumn headerText="Assigned To"
dataField="assignedTo" editable="false">
                              <mx:itemRenderer>
                                 <mx:Component>
                                       <mx:ComboBox  tabEnabled="true"
change="data.assignedTo=selectedItem" text="{data.assignedTo}" >
                                            <mx:dataProvider>
                                               <mx:ArrayCollection>

<mx:String>User1</mx:String>

<mx:String>User2</mx:String>

<mx:String>User3</mx:String>

<mx:String>User4</mx:String>
                                                </mx:ArrayCollection>
                                             </mx:dataProvider>
                                       </mx:ComboBox>
                                 </mx:Component>
                              </mx:itemRenderer>
                        </mx:AdvancedDataGridColumn>
                        <mx:AdvancedDataGridColumn headerText="Target"
itemEditor="com.views.DateEditor" dataField="target"/>


                        <mx:AdvancedDataGridColumn headerText="Priority"
editable="false" dataField="priority">
                              <mx:itemRenderer>
                                 <mx:Component>
                                       <mx:ComboBox  tabEnabled="true"
change="data.priority=selectedItem" text="{data.priority}">
                                            <mx:dataProvider>
                                               <mx:ArrayCollection>

<mx:String>High</mx:String>

<mx:String>Medium</mx:String>

<mx:String>Low</mx:String>

<mx:String>Urgent</mx:String>

<mx:String>None</mx:String>
                                                </mx:ArrayCollection>
                                             </mx:dataProvider>
                                       </mx:ComboBox>
                                 </mx:Component>
                              </mx:itemRenderer>
                        </mx:AdvancedDataGridColumn>
                        <mx:AdvancedDataGridColumn headerText="Status"
editable="false" dataField="status">
                               <mx:itemRenderer>
                                 <mx:Component>
                                       <mx:ComboBox  tabEnabled="true"
change="data.status=selectedItem" text="{data.status}">
                                            <mx:dataProvider>
                                               <mx:ArrayCollection>

<mx:String>Assigned</mx:String>
                                                   <mx:String>Not
Assigned</mx:String>
                                                   <mx:String>Not
Started</mx:String>

                                                </mx:ArrayCollection>
                                             </mx:dataProvider>
                                       </mx:ComboBox>
                                 </mx:Component>
                              </mx:itemRenderer>
                        </mx:AdvancedDataGridColumn>
                    </mx:columns>
                </mx:AdvancedDataGrid>
        <mx:Button x="172" y="35" label="Add Task" click="addTask()"/>
        <mx:Button x="388" y="35" label="Delete" click="deleteTask()"/>


    <mx:Script>
    <![CDATA[

            import mx.collections.ArrayCollection;


            [Bindable]
            private var taskCol:ArrayCollection;

            private function initGrid():void
            {
                taskCol = new ArrayCollection();
                //taskCol.addItem({task: "a",assignedTo: "b",target:
"c",priority: "d",status: "e"});
            }

            private function addTask():void
            {

                taskCol.addItem({task: "",assignedTo: "",target:
"",priority: "",status: ""});

            }

            private function deleteTask():void
            {
                if (taskCol.length > 0 )
                {

                        taskCol.removeItemAt(TaskRole1Grid.selectedIndex);


                }
            }
    ]]>
    </mx:Script>
<mx:Binding source="TaskRole1Grid.dataProvider as ArrayCollection"
destination="taskCol" />
    <mx:Button x="267" y="35" label="Add Sub Task"/>
</mx:Application>

--~--~---------~--~----~------------~-------~--~----~
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