2 Replies Latest reply on Jan 24, 2007 6:35 AM by 187_2007

    Refresh Datagrid

    187_2007 Level 1
      I have a Reset Button:
      <mx:Button label="Reset" x="84" y="393" click="resetGrid()"/>

      It is suppose to refresh my DG:
      <mx:DataGrid id="dg" width="98%" height="350" x="8" y="35" rowCount="5" dataProvider="{ArrayofStructs}" />

      here is my function:

      private function resetGrid():void{


      For some reason it is not refreshing the grid.

      What is it I am trying to do? The dataprovider populates my grid. Then I change some cells. Click my refresh button and nothing. Evidently my syntex is incorrect. Can anyone point me in the right direction?
        • 1. Re: Refresh Datagrid
          how are you populating your arrayofstructs, are you linking it to a Http Service, if so just call...

          • 2. Refresh Datagrid
            187_2007 Level 1
            I'm actually using <mx:RemoteObject>. But I see your solution.. The problem is that my result handler is calling an instance of a class and adding it to an array. So if I call that RemoteObject again, it simply appends to the array. :) Which is great when I want to add another row. I can click a button and it grabs another instance of the Expandables class, set's them to a default within the constructor and appends it to the array, thus updating the grid.

            Here is my example(Click Expandables). You can DL the code if you wish.

            public function resultHandler(event:ResultEvent):void{
            var resultArray:Array = event.result as Array;
            for(var i:int =0; i<resultArray.length; i++) {
            var buildExpandables:Expandables = new Expandables();
            buildExpandables.init(resultArray );

            overall it's a good solution, but there has to be a way to refresh the grid back to it's original state. I'm working on a few solutions.