Well, you can do this programatically pretty easily.  I guess you could
encapsulate the logic in an extended DataGrid.

 

Suppose in the "columnConfigs" setter function, you simply build the
columns array?  I suspect you'd need to ensure the columns are built
before the dataProvider is assigned.

 

Have you done a dynamic column datagrid yet? Here is an example.  It
uses logic in the structure of the dataProvider item to build the
columns, but could just as easily  use the data in the columnConfigs
ArrayCollection.

http://www.cflex.net/showFileDetails.cfm?ObjectID=552

 

Tracy

 

 

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of letterpigeon
Sent: Monday, October 01, 2007 3:02 PM
To: [email protected]
Subject: [flexcoders] Datagrid with dynamic columns

 

Hi,

I'm trying to extend to the DataGrid class (call it DynamicDataGrid)
to make it work with dynamic column definition (# of columns and names
of columns will be fetched at runtime) so that I can use this datagrid
by giving it an array collection as dataprovider (this arraycollection
contains only data) and another array for column configuration. 

Following is what I've done: 

I extended DataGrid to contain one more variable "columnConfigs:Array"
(this array contains objects of type ColumnConfig which has headerText
and columnCode as its instance variables).

In the setter of columnConfigs, I set the headerText for each column
of the datagrid. but the DataGridColumn does not have columnCode
field, so I figured I need to extend DataGridColumn as well
(DynamicDataGridColumn). But i can't think of a good way to make
DynamicDataGrid to use an array of DynamicDataGridColumn for its
"columns" attribute without knowing much about the internal
implemenation of DataGrid. 

Could anyone give me any suggestion? Or if you have a better way of
achieving I'm trying to do here, please help. Thanks.

Ban

 

Reply via email to