1 Reply Latest reply on Nov 2, 2009 3:39 AM by _Natasha_

    Advance Grid using Remote Object

    arunkumard87

      Hai All,

       

      Kindly check this code advance grid is not filling.But the datas are coming .Please help me

       

           private function init():void
                  {
                      ProductDataService = new RemoteObject("GenericDestination");
                      ProductDataService.source = "ClassLibrary1.Class1";
                      ProductDataService.addEventListener(ResultEvent.RESULT,ProductResultHandler);
                      ProductDataService.emp();       
                  }
                   private function ProductResultHandler(event:ResultEvent):void
                  {                      
                      catalog = new ArrayCollection(event.result as Array);               
                      myADGEmp.dataProvider=catalog;
                                     
                  }

       

      <mx:AdvancedDataGrid id="myADGEmp" width="100%" height="100%" color="0x323232" initialize="gcemp.refresh()">
             <mx:dataProvider>
                     <mx:GroupingCollection id="gcemp" source="{catalog}">
                         <mx:grouping>
                             <mx:Grouping>
                                 <mx:GroupingField name="dept"/>                      
                             </mx:Grouping>
                         </mx:grouping>   
                     </mx:GroupingCollection>
             </mx:dataProvider>
                  <mx:columns>
                      <mx:AdvancedDataGridColumn dataField="dept"/>
                      <mx:AdvancedDataGridColumn dataField="empname"/>
                      <mx:AdvancedDataGridColumn dataField="price" headerText="Territory Rep"/>
                  </mx:columns>
             </mx:AdvancedDataGrid>

       

       

      Regards and Thanks,

      Arun

        • 1. Re: Advance Grid using Remote Object
          _Natasha_ Level 4

          Hi,

          there is a logical error in your code.

           

          ADG has GroupingCollection as dataProvider, but you've override it then data loaded.

          In private function ProductResultHandler(event:ResultEvent):void you shoud only call

          gcemp.refresh();

           

          Put the result of this trace to see what's with your data

          private function ProductResultHandler(event:ResultEvent):void
                      {                      
                          catalog = new ArrayCollection(event.result as Array); 

          trace(catalog.length);

          trace(catalog[0]);            
                          myADGEmp.dataProvider=catalog;
                                         
                      }

          1 person found this helpful