I have some problems regarding dynamic datagrid. By dynamic I mean, that I
don't know either the width or the amount of columns. What's more, sometimes
the total width of columns (with static width) exceeds the container's width
and I need to use horizontalScrollPolicy = auto on the grid. No matter how
hard I try, the grid behaves bizarre. Since it does not have the width set
up, the result looks weird, the columns are either stretched or collapsed.
What I would like to achieve is to have normal width, when there are few
columns only, and fully-stretched grid when there are lots of columns (with
scrolling on grid). I've been trying various combinations with width,
maxWidth, minWidth, columns' width and anchoring to left and right, but to
no avail.

The other problem, or problems, is that since I don't know the amount of
columns, it's hard to a) prepare a model, b) build a grid. Since you cannot
use mx:Repeater on datagrid columns, you are forced to manually modify
columns array. That's fine. But what about model? The only way I can think
of, is to just use Object, and dynamically add the property names and their
values, and then in column generation, use dataField on those columns
relating to those properties. What I'm losing here is strong typing - what I
am going to do if I need to edit such row/cell?

Final problem is how to solve datagrid binding when I have data model like
this :
ArrayCollection of objects Item, and each Item is { var
obj1:SomePlainObject; var obj2:AnotherArrayCollection; }

And what I want to have is to have first column populated with value from
the SomePlainObject, and the next columns taking values from items from
within AnotherArrayCollection? I would prefer not to change model, well, it
wouldn't change much here really. I am curious how do you solve such
problems : the necessity of loosing strongly typed of objects. One way is to
use labelFunction for those columns, but that is ineffective, and very
hackery (though through some combinations and hiding values in columns
attributes, I've managed this to work), and the other one is to actually
flatten my model, again, using just Object, and then pass it as just simple
dataprovider. But, what if at some point I will decide that I want to edit
those data? The power of grid and databinding lies in direct association
between cells and data. 

Or maybe I'm just doing something wrong? I would be very grateful for any
advice.


Sebastian Zarzycki
<[EMAIL PROTECTED]>


Reply via email to