Hi,

I've just pushed some changes to FlexJS DataGrid that adds DataGridColumn. This 
work was primarily to allow custom itemRenderers per column. The changes I've 
pushed are initial work - there are properties that aren't implemented or do 
nothing right now, but the code should be safe to use. Next week I'll finish 
this out and clean up the code.  Both ActionScript and JavaScript 
implementations are in-sync.

Here is an example:

<basic:DataGrid id="dataGrid" x="20" y="30" width="400" height="300" 
change="dataGridChange()" >
<basic:beads>
<models:MyGridPresentation rowHeight="50" />
<basic:ConstantBinding
sourceID="applicationModel"
sourcePropertyName="productList"
destinationPropertyName="dataProvider" />
<basic:ConstantBinding
sourceID="applicationModel"
sourcePropertyName="labelFields"
destinationPropertyName="labelFields" />
</basic:beads>
<basic:columns>
<basic:DataGridColumn label="Image" dataField="image" columnWidth="100" 
itemRenderer="products.ProductItemRenderer" />
<basic:DataGridColumn label="Title" dataField="title" columnWidth="200" />
<basic:DataGridColumn label="Sales" dataField="sales" columnWidth="100" />
</basic:columns>
</basic:DataGrid>


I will probably drop the MyGridPresentation model  or find another use for it; 
that model contained the labels for the columns which DataGridColumn now 
supplies. I'll probably also drop the need for the labelFields ConstantBinding 
as DataGridColumn also provides those values.

If you do use this code you'll find that the rows do not have equal height 
unless you specify the height of the itemRenderers using styles, like this:

sample|ProductItemRenderer {
height: 40;
IBeadController: 
ClassReference("org.apache.flex.html.staticControls.beads.controllers.ItemRendererMouseController");
}
basic|StringItemRenderer {
height: 40;
}

(StringItemRenderer is the default itemRenderer for the DataGrid list columns).

I plan on creating a bead that will handle making all of the rows equal in 
height or allow for variable row height. Since FlexJS is a 'pay as you go' 
framework, the added burden of determining row heights is left out by default 
and can be added in when needed using this new bead.

Regards,
Peter Ent
Adobe Systems

Reply via email to