1 Reply Latest reply on Sep 16, 2014 10:24 AM by Flex harUI

    Updating array collection with datagrid

    klq9386

      I am currently working on a simple project as I am very new to flex. I have a few things I am trying to work out. I have the general setup in a data grid as I like it and from the app it does what I need to but there are several problems.

       

      1. I would like increment / decrement buttons for the values that are number based.

      2. I would like when the data grid is changed that the array collection is updated to the new values in the grid so the data can be saved past the current iteration of the app

       

       

      Long term is I would like to get it to connect to my remote SQL server but all the code out there seems to only be doing it locally.

       

      Any help on this would be greatly appreciated.

       

      Here is my code:

       

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

      <!-- dpcontrols\sparkdpcontrols\SparkDGComboBoxIE.mxml -->

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

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

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

          width="450">

       

        <fx:Script>

        <![CDATA[               

        import mx.collections.ArrayCollection;

       

        [Bindable]

        private var myDP:ArrayCollection = new ArrayCollection([

        {TM:"Derek", IPTV:3, IPBB:0, AAL:0},

        {TM:"Clay", IPTV:0, IPBB:0, AAL:4},

        {TM:"Rachael", IPTV:0, IPBB:0, AAL:0},

        {TM:"Kelly", IPTV:0, IPBB:0, AAL:5},

        {TM:"Lucas", IPTV:0, IPBB:0, AAL:5},

        {TM:"Irving", IPTV:0, IPBB:0, AAL:5},

        {TM:"John", IPTV:0, IPBB:0, AAL:5},

        {TM:"Brandon", IPTV:0, IPBB:0, AAL:5},

        {TM:"Matt", IPTV:0, IPBB:0, AAL:5},

        {TM:"Scott", IPTV:0, IPBB:0, AAL:5},

        {TM:"Hunter", IPTV:0, IPBB:0, AAL:5},

        {TM:"Bob", IPTV:0, IPBB:0, AAL:5},

        {TM:"Jim", IPTV:0, IPBB:0, AAL:5},

        {TM:"Zach", IPTV:0, IPBB:0, AAL:5},

        {TM:"Jack", IPTV:0, IPBB:0, AAL:5},

        {TM:"Jeanna", IPTV:0, IPBB:0, AAL:5},

        {TM:"Keith", IPTV:0, IPBB:0, AAL:5},

        {TM:"Billy", IPTV:0, IPBB:0, AAL:5},

        {TM:"Kevin", IPTV:0, IPBB:0, AAL:5},

        {TM:"Jarrid", IPTV:0, IPBB:0, AAL:5},

        {TM:"Kiara", IPTV:0, IPBB:0, AAL:5}

        ]);      

        ]]>

        </fx:Script>

       

        <s:DataGrid id="myDG" width="100%"  height="100%"

        dataProvider="{myDP}"

        variableRowHeight="true"

        editable="true" >

        <s:columns>

        <s:ArrayList>

        <s:GridColumn dataField="TM" headerText="TM name"/>

        <s:GridColumn dataField="IPTV" headerText="IPTV"/>

        <s:GridColumn dataField="IPBB" headerText="IPBB"/>

        <s:GridColumn dataField="AAL" headerText="AAL">

                  </s:GridColumn>

        </s:ArrayList>

        </s:columns >

        </s:DataGrid>

      </s:Application>