6 Replies Latest reply on Mar 20, 2010 9:56 PM by Flex harUI

    Showing some columns from a collection (Datagrid)

    Aron manager

      Hi,

       

      I'm using amf to retrieve some records form a remote database. The result of the remote operation is assigned to a datagrid dataprovider member. This works perfectly. But I need to just show some columns from this result not all. How can I do this? I have tried something like this without luck:

       

              //Assign data

              dataProvider=event.result;

       

              //Clean columns and readd just the ones we need

       

              //Column header, dataField
              var dgColumns:Array=["Id","idUsuario",
                                     "User","usuario",
                                     "Password","password",
                                     "Name","Nombre",
                                     "Email","email"];

       

                  this.columns=new Array();           
                  var i:int=0;
                  while(i<dgColumns.length)
                  {
                      var col:DataGridColumn=new DataGridColumn(dgColumns[i++]);
                      col.dataField=dgColumns[i++];
                      this.columns.push(col);   
                  }

       

      I have seen there's a visible property for the column, don't know if it is a good option to set it to false to all columns I don't want to be seen.

       

      Thanks in advance,

      HexDump.