On Tuesday 24 February 2009 12:09:05 yossi.baram wrote:
> I am doing something like you mensioned for columns,
> my problem is the dataprovider itself that I set to the DataGrid.
> Can I set it dynamically without the need to set
> columnName:columnValue statically?
> To be clear :)
> My current dataprovider is set accornigly in an Array:
> {parent:'root1',col1:100,date:myObject[0],col2:33},
> {parent:'root1',col1:5,date:myObject[1],col2:21},
> {parent:'root2',col1:11,date:myObject[2],col2:5}
>
>
> I need to build it dymanically because the column names(the ones
> before the semicolon) can be different and as I said I get them and
> the values(objects) from Arrays.

If I'm understanding you correctly, you mean that your column names might be 
different, like this?

[
{ colA: "valA", colB: "valB" },
{ colA: "valA", colC: "valC" },
{ colA: "valA", colD: "valD" },
]

If so, logic suggests that you would have to normalise the ArrayCollection 
before providing it as a dataProvider, like this (whitespace added for 
readability):

[
{ colA: "valA",   colB: "valB",   colC: "",          colD: "" },
{ colA: "valA",   colB: "",          colC: "valC",   colD: "" },
{ colA: "valA",   colB: "",          colC: "",          colD: "valD" },
]

Then you can skip declaring and adding DataGridColumns seperately and just 
feed the ArrayCollection to the dataProvider.

Hope this helps.

Cheers,
//gary

Reply via email to