2 Replies Latest reply on Aug 5, 2009 11:41 PM by gsarya

    Dynamic datagrid not refreshing under tilelist

    gsarya

      I am creating a dynamic datagrid (no of column) under tilelist based on selection. When I load first time the no of column of this datagrid displaying correctly. After changing  the selection(increase the no of column / re-create the Arraycollection) data is changing but the no of column still same.

       

      We already know that Createcomplete method excute only first time, when I execute the method under createcomplete explictly from outside I am unable to get datagrid ID and Data of this datagrid under tilelist.

       

      In othercase I am creating dynamic datagrid without tilelist working fine.

       

      Please reply, if you have any suggestions or samples regarding this problem.

       

       

      Thanks in Advance

        • 1. Re: Dynamic datagrid not refreshing under tilelist
          Gregory Lafrance Level 6

          When I am troubleshooting something like this I always try to work at getting a simplified yet "complete" piece of code that still has the problem.

           

          Often, I find the problem along the way as I simplify, but if not, then I have a nice small bit of code to post in this forum, and then I usually get an answer right away.

           

          So we need more info on your problem, and hopefully that simplified yet "complete" code sample exhibiting the problem.

          • 2. Re: Dynamic datagrid not refreshing under tilelist
            gsarya Level 1

             

            Sorry,  This is our sample code.

             

            <mx:Panel

             

             

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

             

                <mx:Metadata>
                      [Event(name="showGrid", type="flash.events.Event")]
                </mx:Metadata>
                <mx:Script>
                  <![CDATA[
                        public function onChanged(my_grid:DataGrid, my_provider:ArrayCollection):void {
                              var myEventObject:onChangedEvent = new onChangedEvent("onGridChanged", my_grid, my_provider);
                            dispatchEvent(myEventObject);

                        }

                        public function initListener():void{
                              parent.addEventListener("showGrid",addNewGrid);
                        };

                        private function addNewGrid(event:Event):void{
                              // trying to call onChanged function with proper Datagrid ID with DATA
                        };

            ]]>
            </mx:Script>

             

            <mx:TileList id="SampleTileList"  dataProvider="{sampleData}">
                  <mx:itemRenderer>
              <mx:Component>
                <mx:HBox width="100%" height="100%" >
                <mx:DataGrid  id="test_grid"  name="test_grid" width="100%"  dataProvider = "{data.mydata_provider}"  creationComplete ="{outerDocument.onChanged(test_grid,data.mydata_provider);outerDocument.initListener();}" />
              </mx:HBox>
                </mx:Component>
              </mx:itemRenderer>
            </mx:TileList>

            </mx:Panel>

             

            sampleData ArrayCollection is re-create  on selection event.