3 Replies Latest reply on Jun 20, 2011 10:16 AM by andres margalef

    AdvancedDataGrid changing dataprovider bug infinite loop

    andres margalef Level 1

      Make the second column width like this image and then click on addRow1:

      gridBug.png

       

       

       

      <code>

       

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

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

      >

       

      <fx:Declarations>

      <s:ArrayCollection id="dp">

      <fx:Object descripcion="descripcion1" />

      <fx:Object descripcion="descripcion2" />

      <fx:Object descripcion="descripcion3" />

      <fx:Object descripcion="descripcion4" />

      </s:ArrayCollection>

      </fx:Declarations>

       

      <fx:Script>

      <![CDATA[

      import mx.collections.ArrayCollection;

       

      protected function btnAceptar_clickHandler(event:MouseEvent):void {

      var aux:ArrayCollection = new ArrayCollection(dp.toArray());

      var obj:Object = new Object();

      obj.descripcion = "descripcion" + dp.length;

      aux.addItem(obj);

      dp = aux;

      }

       

      protected function button1_clickHandler(event:MouseEvent):void {

      var obj:Object = new Object();

      obj.descripcion = "descripcion" + dp.length;

      dp.addItem(obj);

      }

       

      ]]>

      </fx:Script>

       

      <s:layout>

      <s:VerticalLayout />

      </s:layout>

       

      <s:Panel>

      <mx:AdvancedDataGrid id="grilla" dataProvider="{dp}" width="100%" height="100%"

      horizontalScrollPolicy="auto"

      >

      <mx:columns>

      <mx:AdvancedDataGridColumn dataField="descripcion" />

      <mx:AdvancedDataGridColumn dataField="descripcion" />

      </mx:columns>

      </mx:AdvancedDataGrid>

      </s:Panel>

       

      <s:Button label="addRow1" click="btnAceptar_clickHandler(event)" />

      <s:Button label="addRow1" click="button1_clickHandler(event)" />

       

      </s:Application>

       

      </code>

        • 2. Re: AdvancedDataGrid changing dataprovider bug infinite loop
          Flex harUI Adobe Employee

          I might be able to help if you simplify your test case some more.  Assign a

          fixed with to the ADG so we know exactly what width is causing a problem,

          and fix the steps or labels on the buttons so we understand what to do.

          • 3. Re: AdvancedDataGrid changing dataprovider bug infinite loop
            andres margalef Level 1

            When the width property is not used, it fails. I can't simplify more than this sorry.

             

            Steps:

            • click on Fail button

             

            
            <?xml version="1.0" encoding="utf-8"?>
            <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="300" height="300"
                 >
            
                 <fx:Declarations>
                      <s:ArrayCollection id="dp">
                           <fx:Object description1="description" description2="description"/>
                           <fx:Object description1="description" description2="description"/>
                           <fx:Object description1="description" description2="description"/>
                           <fx:Object description1="description" description2="description"/>
                      </s:ArrayCollection>
                 </fx:Declarations>
                 
                 <fx:Script>
                      <![CDATA[
                           import mx.collections.ArrayCollection;
                           
                           protected function fail_clickHandler(event:MouseEvent):void {
                                var obj:Object = new Object();
                                obj.descripcion = "description";
                                
                                var aux:ArrayCollection = new ArrayCollection(dp.toArray());
                                aux.addItem(obj);
                                dp = aux;
                           }
            
                      ]]>
                 </fx:Script>
                 
                 <s:layout>
                      <s:VerticalLayout />
                 </s:layout>
                 
                 <mx:AdvancedDataGrid id="grid" dataProvider="{dp}" height="160" horizontalScrollPolicy="auto">
                      <mx:columns>
                           <mx:AdvancedDataGridColumn dataField="description1" width="200"/>
                           <mx:AdvancedDataGridColumn dataField="description2" width="5"/>
                      </mx:columns>
                 </mx:AdvancedDataGrid>
                 
                 <s:Button id="fail" label="FAIL" click="fail_clickHandler(event)" />
            </s:Application>