Monday, January 28, 2008

DataGrid Rendering

The default editing control for an editable column is a text field. It is possible to specify the editor via itemEditor attribute and editorDataField. Following controls can be specified:

Button, Label, CheckBox, NumericStepper, ComboBox, Text, DateField, TextArea, Image, TextInput

You can also specify your own control as long as it implements IDropInListItemRenderer interface in its class definition

Item renderers can be used to customize looks of individual columns.

One way is to make a custom renderer (say using Canvas) as an MXML component and giving the appropriate DataGridColumn the full-qualified path to itemRenderer property. Remember that the data property will help you in the renderer to access row data.

Another way is using
tag. Efficient but not modular. Inside the renderer tag you will have to place tag. What is inside this tag will have its own scope, will need its own imports. You can talk to the containing app using outerDocument scope. But the properties you wish to access have to be public.

labelFunction signature for DataGrids is:

labelFunctionName(item:Object,dataField:DataGridColumn)


No comments: