Hello guys,
I have extended List component to measure total height of rows. I would like
to display the entire contents of the list with no scrollbars and its height
is based on the total height of each row. I have overriden measure method to
do just that. This is what the class looks like:
public class ExtendedList extends List
{
public function ExtendedList():void
{
super();
variableRowHeight = true;
liveScrolling = true;
verticalScrollPolicy = ScrollPolicy.OFF;
selectable = false;
}
override protected function measure():void
{
super.measure();
measuredHeight = super.measureHeightOfItems(0,
super.dataProvider.length);
}
}
I have also a custom renderer:
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" verticalGap="0"
horizontalGap="0" dataChange="setRecord()">
<mx:Script>
<![CDATA[
private function setRecord():void
{
if (data == null) return;
if (data.noneFlag) {
noRecord.createComponentsFromDescriptors();
record.removeAllChildren();
} else {
record.createComponentsFromDescriptors();
noRecord.removeAllChildren();
}
}
]]>
</mx:Script>
<mx:VBox id="record" width="100%" verticalGap="0" horizontalGap="0"
creationPolicy="none">
<mx:HBox id="row1" width="100%" verticalGap="0"
horizontalGap="0">
<mx:Text width="150" text="Herbal/Over the Counter
Medication"/>
<mx:Text width="100" text="{data.medication ?
data.medication : ' '}"/>
<mx:Text width="100" text="Start Date"/>
<mx:Text width="100" text="{data.startDate ?
data.startDate : ' '}"/>
<mx:Text width="100" text="End Date"/>
<mx:Text width="100" text="{data.endDate ?
data.endDate : ' '}"/>
</mx:HBox>
<mx:HBox id="row2" width="100%" verticalGap="0"
horizontalGap="0">
<mx:Text width="150" text="Dosage"/>
<mx:Text width="300" text="{data.dosage ? data.dosage :
' '}"/>
</mx:HBox>
<mx:HBox id="row3" width="100%" verticalGap="0"
horizontalGap="0">
<mx:Text width="150" text="Frequency"/>
<mx:Text width="300" text="{data.freq ? data.freq : '
'}"/>
</mx:HBox>
</mx:VBox>
<mx:HBox id="noRecord" width="100%" verticalGap="0" horizontalGap="0"
creationPolicy="none">
<mx:Text width="150" text="Herbal/Over the Counter Medication"/>
<mx:Text width="100" text="{data.medication ? data.medication :
' '}"/>
<mx:Text width="100" text="Start Date"/>
<mx:Text width="300" text="{data.startDate ? data.startDate : '
'}"/>
</mx:HBox>
</mx:VBox>
The extended list class seems to work fine in terms of getting the total
height of rows. The container with noRecord id computes its measuredHeight
perfectly based on its child components. However, when it comes to the
container with record id, it doesn't correctly compute for its
measuredHeight based on its child components which are HBox(es). I am
already at a loss here. It seems that VBox doesn't know how to get the total
height of its child HBox components. So when rendered, I could only see data
from noRecord container. Please guide me.
--
View this message in context:
http://www.nabble.com/VariableRowHeight-tf4584231.html#a13085850
Sent from the Cold Fusion - Flex mailing list archive at Nabble.com.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta
Archive: http://www.houseoffusion.com/groups/Flex/message.cfm/messageid:4674
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37