I have a problem with datefield in advanceddatagrid.The problem is when i
click the add button the datefield selected in the previous row will be
removed.How to solve this.
The code is shown below

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
creationComplete="init()" layout="absolute">
    <mx:Script>
        <![CDATA[

        import mx.events.ListEvent;
        import mx.controls.Alert;
        import mx.collections.ArrayCollection;

        [Bindable]
        private var taskCol:ArrayCollection;

        public function init():void
        {
            grid.initialize();
            taskCol = new ArrayCollection();
        }

        public function add():void
            {
                var month:int = new Date().month;
                var date:int = new Date().date;
                var year:int = new Date().fullYear;
                var today:String = year.toString() + "/" + month.toString()
+ "/" + date.toString();
                taskCol.addItem({date: today,task: ""});
            }



        ]]>
    </mx:Script>


    <mx:AdvancedDataGrid id="grid" x="136" y="141" dataProvider="{taskCol}"
designViewDataType="tree">
        <mx:columns>
            <mx:AdvancedDataGridColumn id="targetid" headerText="Target"
editable="false" dataField="dt" itemRenderer = "mx.controls.DateField"
                    rendererIsEditor="true"
editorDataField="selectedDate"/>

            <mx:AdvancedDataGridColumn headerText="Column 2"
dataField="task">
            <mx:itemRenderer>
                                 <mx:Component>

                                       <mx:ComboBox  tabEnabled="true"
selectedIndex="1"   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:ArrayCollection>

                                             </mx:dataProvider>

                                       </mx:ComboBox>
                                 </mx:Component>

                              </mx:itemRenderer>

                        </mx:AdvancedDataGridColumn>
        </mx:columns>
    </mx:AdvancedDataGrid>
    <mx:Button x="396" y="250" label="Add" click="add()"/>

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