Posts

Showing posts with the label itemRenderer

Word wrap in AdvancedDataGrid

So getting a column field to wrap in an AdvancedDataGrid isn't as easy as just setting the "wordWrap" property to true. Maybe it should be, but it isn't. First thing's first. Do you have an itemRenderer on the column you're trying to wrap. If the answer is yes you have to make sure that itemRenderer is based on a wrappable component. For argument's sake, lets say you have a Label itemRenderer, well you're going to have to change that to be based on Text, and you're going to have to give it a width to give it the capability to wrap (percentWidth = 100 works nicely). Then set your wrap-able column to wordWrap = true . Finally set your AdvancedDataGrid to have property variableRowHeight = true . Here is a link to an example with the view source enabled.

Flex Checkbox as Grid item editor and renderer

I have a dataGrid with a few columns that are simply check boxes. The kicker is I want the user to be able to edit those check boxes. So I knew the first step, using the renderer to have the data from the data provider show up in a check box, but I had to do some research for the editor part. Here is the code snip of the DataGridColumn that should help you out if you were trying to do that same thing. (Warning: the textAlign property may only work in Flex 3). <mx:DataGridColumn dataField="isOpen" headerText="Open" editable="true" textAlign="center" itemEditor="mx.controls.CheckBox" editorDataField="selected" itemRenderer="mx.controls.CheckBox"/> The important part to this that I was missing is: editorDataField="selected" This returns the value of the 'selected' property to the data provider, otherwise, by default it looks to return the "text" property, which a ch...