2 Replies Latest reply on Aug 9, 2010 5:50 PM by ssardar

    Creating AdvancedDataGrid in AS

    ssardar Level 1

      ok I'll try to make this clear as possible.

       

      I've decided to create my AdvancedDataGrid in Actionscript becuase the users want to be able to create columns dynamically.

       

      My service returns a ListCollectionView of object proxies.

      Which I then cast into an ArrayCollection of Objects.

       

       

       

       

      private var myADG:AdvancedDataGrid = new AdvancedDataGrid;

       

       

       

       

       

      private function generateGrid():void

      {

       

      var clms:Array;

       

      myADG.dataProvider=gridData;

      myADG.percentWidth=100;

      myADG.percentHeight=100;

      myADG.visible=

      true;

      myADG.x=0;

      myADG.y=0;

      myADG.designViewDataType=

      "flat";

      myADG.horizontalScrollPolicy=

      "on";

      myADG.verticalScrollPolicy=

      "on";

      myADG.lockedColumnCount=6;

      myADG.sortExpertMode=

      true;

      myADG.headerWordWrap=

      true;

       

       

      clms = myADG.columns;

       

      //loop to add columns

       

      var adgc:AdvancedDataGridColumn = new AdvancedDataGridColumn();

       

      adgc.headerText=

      "Sales Order"

      adgc.dataField=myADG.dataProvider.pdNO;   <-----I have no idea what should be, pdNO is a variable from the list of objects that are returned.

      adgc.width=72

      adgc.visible=

      true;

       

      clms.push(adgc);

       

      //end loop

       

      myADG.columns=clms;

       

       

       

      pan1.addChild(myADG);

      }

       

       

      I'm a little unclear how to capture the columns from the existing data set (I am just trying to build the grid as is, none of the dynamic stuff yet).

      I had this all in MXML before and it was fairly easy to bind the dataField based on each Object property.  But how do I do that now, yes i know it needs to be a loop through an array, but I was just trying to add one column for now to see if I can get it to work.

       

      Thanks in advance, I hope that's clear.