2 Replies Latest reply on Oct 1, 2009 8:46 AM by zakabalt

    Load DataGrid with a service information

    zakabalt Level 1

      Hello everybody, I'm loading one datagrid using one service (on Java) that give me some date to load a DataGrid but I have a problem. I want to call to more than one method and with this dates create an array, and then give the array to the dataGrid. The problem is that I get only one date with one call, and I want to get al the dates of the array with one call. Now I'm doing that, I load my datagrid with something like this:

       

      Subject - Null - Null - Null

      Subject - From - Null - Null

      Subject - From - Date - Null

      Subject - From - Date - Size

      Subject2 - From - Date - Size

      Subject2 - From2 - Date - Size

      Subject2 - From2 - Date2 - Size

      Subject2 - From2 - Date2 - Size2

      . . . . . . . . . . . .

      Subject5 - From5 - Date5 - Size4

      Subject5 - From5 - Date5 - Size5

       

      And I want that:

       

      Subject - From . Date - Size

      Subject2 - From2 - Date2 - Size2

      ....

      Subject5 - From5 - Date5 - Size5

       

      Here the code

       

      //The columns of the DataGrid

      public var columnas:ArrayCollection = new ArrayCollection([
                                  {headerText: 'R', dataField: 'leido', textAlign: 'left', renderType:'text',width: '5' },
                                  {headerText: 'Asunto', dataField: 'subject', textAlign: 'left',  renderType:'text', width: '100' },
                                  {headerText: 'Remitente', dataField: 'from', textAlign: 'left',  renderType:'text', width: '70' },
                                  {headerText: 'Fecha', dataField: 'date', textAlign: 'left',  renderType:'text', width: '35' },

                                  {headerText: 'Tamaño', dataField: 'size', textAlign: 'left',  renderType:'text', width: '40' },
                                  {headerText: 'Adj', dataField: 'adjunto', textAlign: 'right',  renderType:'text', width: '10' },
                                  ]);

       

       

      //Valing to my java service methods

      public function onInfoResult(event:ListEvent):void {
                 
                  _service.addEventListener(ResultEvent.RESULT, tablaLoadedResult);
                  _service.addEventListener(FaultEvent.FAULT, tablaLoadedError);
                 
                  for(var i:Number=1;i<5;i++)//To get 5 lines in the DataGrid
                  {               
                      _service.getSubject(i,'INBOX');
                      _service.getFrom(i,'INBOX');
                      _service.getDate(i,'INBOX');
                      _service.getSize(i,'INBOX');
                  }
               }

       

      public function tablaLoadedResult(event:ResultEvent):void {
                 
                    var subject:String = String(_service.getSubject.lastResult.toString());
                    var from:String= String(_service.getFrom.lastResult);
                    var date:String= String(_service.getDate.lastResult);
                    var size:Number = _service.getSize.lastResult;
                     array.addItem({read:"T",subject:subject,from:from,date:date,size:size,adj:"A"});                 
                  }                          

      public function tablaLoadedError(event:FaultEvent):void{
                  textArea.text = "Fallo : " + event.message;
              }

       

      I don't know if I'm doing correctly or it's completly wrong.

       

      Thanks!