Flex - How To Modify The Verticle Gap In A Repeater - apache-flex

I Have a VBox, and set the verticleGap = 0. Inside the VBox I have a Repeater. When I run the App, the items listed from the Repeater have a large gap between each line. Is there a way to set the verticleGap on the Repeater, or reduce that space?
Thanks

Two things: First, the property is misspelled, it should be "verticalGap" for your VBox. Second, if your repeated components are all the same height, you could set an explicit height for your Repeater component, such as height="22". Hope that helps.

Related

Flex: Make ComboBox dynamically resize so that it will always fit its contents?

I've got a combo box like this:
<mx:ComboBox dataProvider="{someArrayCollection}" />
But when the contents of someArrayCollection change, it leaves the combo box too small:
How can I trick the combo box into automatically resizing to fit the label of the largest item?
So the problem is that the ComboBox doesn't invalidateSize() after the dataProvider dispatches a COLLECTION_CHANGE event.
Lame.
It can be fixed by calling myComboBox.invalidateSize() when ever the dataProvider dispatches a COLLECTION_CHANGE.
Basically, you just loop over the dataProvider, measure the width of each item's label, and keep track of the largest one.
I sort of built this into the Flextras AutoCompletComboBox. There is a property named expandDropDownToContent which expands the drop down so it has no scroll bars, but it will not inherently expand the prompt portion.
The Spark DropDownList has a property named typicalItem which does something similar. Oddly that property does not seemed to be defined in the DropDownList at this time.
12/23/3011 update
Since this keeps getting downvoted, I wanted to explicitly state. When the MX/Halo ComboBox sizes itself automatically, it does so based on only the initial items that will be displayed in the drop down. If you don't loop over all items in the dataProvider to determine the proper size of the ComboBox/DropDown then items may be cut off regardless of whether you call invalidateSize() or not when items in the dataProvider change.

Adapting the width of a Flexs 3 DataGridColumn to the content of its ItemRenderer?

I have the following scenario :
A Flex 3 DataGrid is sitting here
At runtime, a column is added to this grid
The column has a custom ItemRenderer
The ItemRenderer inherits from HBox, and adds a few items to the HBOx dynamically
My problem is that the width of the column doesn't change. As a consequence, my column stays small, and an ugly horizontal scrollbar is displayed in the line, instead of my content (which is completely unreadable).
I would like the column to adapt its width to the content of the HBox in the ItemRenderer. I tried the following :
Setting the 'percentWidth' of the ItemRenderer to '100'
Invalidating the properties of the ItemRenderer after adding the items
The only thing that has a "visible" effect it to force the width of the DataGridColumn. Obviously this is not acceptable since I'm dynamically adding components to the ItemRenderer, and I don't know how many or how big they are.
Besides, when I am in the ItemRenderer, I have no access to the column itself (or do I ?) so I cannot force the size of the column from here.
So is there a way around this ? Would AdvancedDataGrid help here (notwhistanding the fact that I cannot really use it for other reasons ...)
Alternatively, I would be happy enough if someone has a solution where the column cell is displayed without the ugly horizontal scrollbar (don't mention setting horizontalScrollPolicy to "off", been there, tried that, lost shirt ;) ).
Thanks
PH
I did not found a solution for the size, however I found the way to remove the scrollbar ; you must put the "horizontalScrollPolicy : 'off'" in the list of properties of the itemRenderer Factory (rather then on the itemRenderer itself).

calculate the height of parent element

I have three datagrids inside VBox container. Since I don't want scrollbar in my flex widget i am increasing the height of SWF
through javascript, which increases with each addition of row in my datagrid. My query is how can I get the exact height of
my VBox which is the parent element of datagrid. I am not able to get the height of VBox. I have tried to use measuredHeight,height with no success.
Could anybody please suggest me the way out for the same.
Thanks in advance!!!
vbox.height should give you theheight of the DataGrid.

Flex - How can we measure the height of a control with nested renders?

I'm using a List control.
In the renderer of the List control I've got a Repeater.
Each Repeater can have a different number of items.
Adding to the complexity, one of the components being repeated in the
repeater is a Text control that has long text that will wrap,
increasing it's height.
I need to expand the height of the List completely so that there's no
vertical scrollbar.
How can I do this?
I tried an extremely dirty attempt at calculating the Lists height
based on the data source. From the data source I can figure out the
number of repeater items and the number of items in each repeater in
the List's renderer. But there's no way to compensate for the wrapping
of the text in the Text control.
Is there a better way (or any way!) to do this? Please help.
Thanks in advance,
zxcvb
This method might help measureHeightOfItems()

Auto-sizing the height of a TileList

Is there a way to have the TileList component to auto-size to its contents? I have tried setting it 100%, but it seems that won't help. I don't want to hard-code the height because the content will be vary, and I don't want scrollbars to show up. Please help.
This is how I ended up solving this issue:
First I set the values for rowHeight and maxColumn properties. Then I did a little function that fires on the updateComplete event of the TileList to calculate the height of the tileList by doing a rowHeight * number of rows.
That worked.
Try creating an event handler when the tilelist changes, calculate the height based on the children then resize the child list based on that value.

Resources