You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Oleg Konovalov <ol...@gmail.com> on 2013/01/12 21:45:25 UTC

Dynamic DataGrid

Hi,

I am trying to create dynamic DataGrid,
which shows columns only if it contains data
return by query (it has 10+ columns, so not easy to calculate sizes)..
I read a lot of posts on the net, tried  minWidth, ResizeMode, etc.

Nothing really useful which works.
In most cases  it created very narrow columns except the last one - super
wide.

Please help!

(using Flex4 AdvancedDataGrid)

-- 
Thank you in advance,
Oleg.

RE: Dynamic DataGrid

Posted by Kessler CTR Mark J <ma...@usmc.mil>.
Well a regular s:DataGrid you could loop through the rows checking each column you have then change the visibility of a column without any data.

Number of rows: yourDataGrid.dataProviderLength
List of columns: yourDataGrid.columns
Number of columns: yourDataGrid.columnsLength

Hide/Show column:  yourDataGrid.columns.getItemAt(index).visible = true/false


If your data is coming from a server/database you may just send a few values back showing which columns are empty since you might be looping to read records anyways.

Not sure how the same idea would work with the AdvancedDataGrid, but it does have a columns and dataProvider properties.  Just have to get the lengths from those properties directly.





-Mark

-----Original Message-----
From: Oleg Konovalov [mailto:olegkon@gmail.com] 
Sent: Saturday, January 12, 2013 15:45
To: dev@flex.apache.org
Subject: Dynamic DataGrid

Hi,

I am trying to create dynamic DataGrid,
which shows columns only if it contains data
return by query (it has 10+ columns, so not easy to calculate sizes)..
I read a lot of posts on the net, tried  minWidth, ResizeMode, etc.

Nothing really useful which works.
In most cases  it created very narrow columns except the last one - super
wide.

Please help!

(using Flex4 AdvancedDataGrid)

-- 
Thank you in advance,
Oleg.