//name and rating are the field names in the dataProvider
myGrid.columns=["name","rating"]
and call it a day...
But that leaves you with evenly spaced columns and without any dynamic height of your grid, so you better resort to something like:
var nameCol:DataGridColumn=new DataGridColumn("name");
nameCol.headerText="Game";
nameCol.width=150;
var ratingCol:DataGridColumn=new DataGridColumn("rating");
ratingCol.headerText="Rating";
ratingCol.width=60;
myGrid.columns = [nameCol, ratingCol];
myGrid.width=210;
myGrid.dataProvider=new DataProvider(dp);
//auto-height
myGrid.rowCount=myGrid.length;
which will let you size the columns at your will and have the component grow as you plug in more entries.
Keine Kommentare:
Kommentar veröffentlichen
You might as well leave a comment on this matter: