3 Replies Latest reply on Mar 27, 2010 3:05 AM by vivo123456

    Data in AdvanceDdataGrid not changed

    vivo123456

      Hello all,
      I have really weird problem, I think it's related to datprovider or something similar.

       

      I have data grid in ac class (as attribute of this class), in the main app, I was import that class and create new instance, and create ArrayCollection according to some parameters(inside the main), after the ArrayCollection been created I assign it to the AdvanceDdataGrid's dataProvider, and everything OK till now.

       

      but if I'm trying to change the values in the grid, it's back to previous value immediately, it's seems like the data provider doesn't binded to the  ArrayCollection at all, but like I already said I made the assignment to the dataProvider.

       

      PS - The grid created inside ac class, and the main flow handled in ac code.

       

       

       

      Thanks in advance,
      Avi.

        • 1. Re: Data in AdvanceDdataGrid not changed
          vivo123456 Level 1

          I create a simple example that illustrate the problem, rty to change the grid's values,
          Thanks.

           

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

          <!-- http://blog.flexexamples.com/2008/05/11/creating-an-editable-datagrid-control-in-flex/ -->

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

                  layout="vertical"

                  verticalAlign="middle"

                  backgroundColor="white" initialize="init();">

           

              <mx:Script>

                  <![CDATA[

                  import mx.controls.advancedDataGridClasses.AdvancedDataGridColumnGroup;

                  import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;

                  import mx.controls.AdvancedDataGrid;

                  import mx.collections.ArrayCollection;

                  import mx.controls.Alert;

                      import mx.events.DataGridEvent;

           

          public var arr:ArrayCollection = new ArrayCollection([

          {xyz:{x:1,y:2,z:3}},

          {xyz:{x:1,y:2,z:3}},

          {xyz:{x:1,y:2,z:3}}

          ]);

           

          public var grid:AdvancedDataGrid = new AdvancedDataGrid();

          public var gridColx:AdvancedDataGridColumn = new AdvancedDataGridColumn("x");

          public var gridColy:AdvancedDataGridColumn = new AdvancedDataGridColumn("y");

          public var gridColz:AdvancedDataGridColumn = new AdvancedDataGridColumn("z");

          public var gridColGroup:AdvancedDataGridColumnGroup = new AdvancedDataGridColumnGroup("xyz");

                      private function init():void

                      {

                      gridColGroup.dataField = "xyz";

                      gridColx.dataField = "x" ;

                      gridColy.dataField = "y" ;

                      gridColz.dataField = "z" ;

                      gridColz.editable = true ;

                      gridColGroup.children = [gridColx,gridColy,gridColz];

                      grid.groupedColumns = [gridColGroup]

                      grid.editable = "item";

                      grid.dataProvider = arr ;

                      this.addChild(grid);

                      }

           

                  ]]>

              </mx:Script>

           

          </mx:Application>

          • 2. Re: Data in AdvanceDdataGrid not changed
            vivo123456 Level 1

            I just realize that the problem related to the group column..

            • 3. Re: Data in AdvanceDdataGrid not changed
              vivo123456 Level 1

              OK, It seems that I manage discussion with myself here, but I found out that if the dataField removed from group column, than it allows you to edit, but then grid dataProvider not detect the arrayCollection structure.

               

              Thanks again, I'll be glad to get any piece of information.