How to add Column to Adobe flex mx:DataGrid in mxml and/or actionsctpt?

The best way to add rows is to use a bindable dataProvider, and I prefer the ArrayCollection Class Bindable public var MyAC:ArrayCollection = new ArrayCollection( {scheduledDate:"4/1/2006", homeTeam:"Chester Bucks",awayTeam:"Long Valley field:"Dawn Field", umpire:"Phil McKraken"} ) Then in your datagrid, instead of defining your DP through MXML add it like this: mx:DataGrid id="dataGrid" editable="true" dataprovider="{MyAC} Then you can add rows by adding items into your MyAC var via action script: MyAC. AddItem({scheduledDate:"4/5/2006", homeTeam:"Long Valley awayTeam:"Chester Bucks", field:"Sunset Field", Umpire:"Amanda Hugenkis"}) Since it's bound it will automatically show up in the dataGrid Assume you define your columns in MXML as in your example you can add the Umpire column like so: dataGrid.columns. Push(new DataGridColumn("Umpire")) Credit to ClownBaby for the column adding AS that was already posted EDIT 2/1/2010: Full Code Example?

Xml version="1.0" encoding="utf-8"?

The best way to add rows is to use a bindable dataProvider, and I prefer the ArrayCollection Class. Bindable public var MyAC:ArrayCollection = new ArrayCollection( {scheduledDate:"4/1/2006", homeTeam:"Chester Bucks",awayTeam:"Long Valley field:"Dawn Field", umpire:"Phil McKraken"} ); Then in your datagrid, instead of defining your DP through MXML add it like this: Then you can add rows by adding items into your MyAC var via action script: MyAC. AddItem({scheduledDate:"4/5/2006", homeTeam:"Long Valley awayTeam:"Chester Bucks", field:"Sunset Field", Umpire:"Amanda Hugenkis"}) Since it's bound it will automatically show up in the dataGrid.

Assume you define your columns in MXML as in your example you can add the Umpire column like so: dataGrid.columns. Push(new DataGridColumn("Umpire")); Credit to ClownBaby for the column adding AS that was already posted. EDIT 2/1/2010: Full Code Example.

Sorry - it does not work( – Kabumbus Jan 29 '10 at 22:48 It does not add rows to data grid more than once to!((( – Kabumbus Jan 29 '10 at 23:20 post the code you're using to add a row so we can see why. – invertedSpear Jan 29 '10 at 23:39 added code example (folowing your ideas). – Kabumbus Jan 29 '10 at 21:13 I have added a huge example that illustrates all of our points and works at adding more than one row, and more than one column.

– invertedSpear Jan 29 '10 at 15:38.

From what I can gather you are trying to dynamically add some columns to your Datagrid: dataGrid.columns. Push(new DataGridColumn("dataField")).

Sorry - it does not work( – Kabumbus Jan 29 '10 at 22:27 It does not add rows to data grid more than once!((( – Kabumbus Jan 29 '10 at 23:19.

The fallowing example add 10 column to datagrid "myGrid" private var columns:Array; for (var i:int=0; iColumns=columns.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions