• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

how to save the edited datagrid using array collection?

New Here ,
Jan 24, 2012 Jan 24, 2012

Copy link to clipboard

Copied

<?xml version="1.0" encoding="utf-8"?>

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"

                    xmlns:s="library://ns.adobe.com/flex/spark"

                    xmlns:mx="library://ns.adobe.com/flex/mx"

                    title="demo2">

          <fx:Declarations>

                    <!-- Place non-visual elements (e.g., services, value objects) here -->

          </fx:Declarations>

          <fx:Script>

                    <![CDATA[               

                              import mx.collections.ArrayCollection;

                              import mx.events.FlexEvent;

           

                              import spark.components.gridClasses.IGridItemEditor;

                              import spark.components.gridClasses.IGridItemRenderer;

                              import spark.events.GridItemEditorEvent;

 

                              [Bindable]

                              private var myDP:ArrayCollection = new ArrayCollection([

                                        {label1:"Day1 ", label2:" Sub1", label3:"Sub2 ", label4:"Sub3 ", label5:"Sub4 ", label6:"Sub5 ", label7:"Sub6 "},

                                        {label1:"Day2 ", label2:" Sub1", label3:"Sub2 ", label4:"Sub3 ", label5:"Sub4 ", label6:"Sub5 ", label7:"Sub6 "},

                                        {label1:"Day3 ", label2:" Sub1", label3:"Sub2 ", label4:"Sub3 ", label5:"Sub4 ", label6:"Sub5 ", label7:"Sub6 "},

                                        {label1:"Day4 ", label2:" Sub1", label3:"Sub2 ", label4:"Sub3 ", label5:"Sub4 ", label6:"Sub5 ", label7:"Sub6 "},

                                        {label1:"Day5 ", label2:" Sub1", label3:"Sub2 ", label4:"Sub3 ", label5:"Sub4 ", label6:"Sub5 ", label7:"Sub6 "},

                                        {label1:"Day6 ", label2:" Sub1", label3:"Sub2 ", label4:"Sub3 ", label5:"Sub4 ", label6:"Sub5 ", label7:"Sub6 "}

                                            

                              ]);      

 

 

 

                              protected function myDG_gridItemEditorSessionSaveHandler(event:GridItemEditorEvent):void

                              {

                                        // TODO Auto-generated method stub

 

                              }

 

                              protected function button1_clickHandler(event:MouseEvent):void

                              {

                                        // TODO Auto-generated method stub

                                        navigator.popView();

                              }

 

                              protected function button2_clickHandler(event:MouseEvent):void

                              {

                                        // TODO Auto-generated method stub

 

                                        myDG.editable=false;

                                        myDP

 

                              }

 

                              protected function myDG_exitStateHandler(event:FlexEvent):void

                              {

                                        // TODO Auto-generated method stub

 

                              }

 

                    ]]>

          </fx:Script>

 

          <s:DataGrid id="myDG" x="10" y="45" width="460" height="240" dataProvider="{myDP}"

                                        editable="true" exitState="myDG_exitStateHandler(event)" fontSize="11"

                                        gridItemEditorSessionSave="myDG_gridItemEditorSessionSaveHandler(event)"

                                        rowHeight="30" variableRowHeight="true" selectionMode="singleCell" >

                    <s:columns>

                              <s:ArrayList>

                                        <s:GridColumn dataField="label1" headerText="day" editable="false" />

                                        <s:GridColumn dataField="label2" headerText="9-10am"/>

                                        <s:GridColumn dataField="label3" headerText="10-11am"/>

                                        <s:GridColumn dataField="label4" headerText="11am-12noon"/>

                                        <s:GridColumn dataField="label5" headerText="1-2pm"/>

                                        <s:GridColumn dataField="label6" headerText="2-3pm"/>

                                        <s:GridColumn dataField="label7" headerText="3-4pm"/>            

                              </s:ArrayList>

                    </s:columns >

          </s:DataGrid>

          <s:Button x="404" y="10" width="53" height="27" label="Back" click="button1_clickHandler(event)"

                                fontSize="13"/>

          <s:Button x="24" y="10" width="56" height="27" label="Save" click="button2_clickHandler(event)"

                                fontSize="14"/>

</s:View>

please help me with this code...i dontknow how to save the data edited in the datagrid back to my arrayollection!!!

TOPICS
Flex SDK

Views

809

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 24, 2012 Jan 24, 2012

Copy link to clipboard

Copied

LATEST

please help with this......

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines