nsurendiran
10-01-2008, 05:14 AM
Hi All,
I am using AdvancedDataGrid to dispay series of rows which has 4 columns and I am using TextBox for all the columns using itemRenderer.
Earlier I used a Label and I had the height property hardcoded for each column to display multiline text, then I realized that If I use the Text component it will get adjusted to the multiline text automatically.
Now, the problem I am facing is that, I am using
myGrid.measureHeightOfItems(0, singlePageDp.length);
to calculate the height of the grid, since I set variableRowHeight="true" for the ADG, and I also have to display multiline, so the height may vary.
When I was using the Label in the ADG to display values in the itemRenderer it was giving the correct rowHeight(Also I hardcoded the height for the labels). But after I replace the Label to Text, I am always getting the rowHeight as 22 ( which I found wrong).
The code below I was using earlier with the Label,
<mx:AdvancedDataGridColumn backgroundColor="black" headerText="Name">
<mx:itemRenderer>
<mx:Component>
<mx:Label text="{data.getNames()}" height="{data.names.length * bodyFontsize}"/>
</mx:Component>
</mx:itemRenderer>
</mx:AdvancedDataGridColumn>
to avoid the hardcoded height I replace the Label with the text like below
where I am getting the same output.
<mx:AdvancedDataGridColumn backgroundColor="black" headerText="Name">
<mx:itemRenderer>
<mx:Component>
<mx:Text text="{data.getNames()}"/>
</mx:Component>
</mx:itemRenderer>
</mx:AdvancedDataGridColumn>
How I can calculate the rowHeight in this case?
Any suggestions would be helpful.
Thanks.
I am using AdvancedDataGrid to dispay series of rows which has 4 columns and I am using TextBox for all the columns using itemRenderer.
Earlier I used a Label and I had the height property hardcoded for each column to display multiline text, then I realized that If I use the Text component it will get adjusted to the multiline text automatically.
Now, the problem I am facing is that, I am using
myGrid.measureHeightOfItems(0, singlePageDp.length);
to calculate the height of the grid, since I set variableRowHeight="true" for the ADG, and I also have to display multiline, so the height may vary.
When I was using the Label in the ADG to display values in the itemRenderer it was giving the correct rowHeight(Also I hardcoded the height for the labels). But after I replace the Label to Text, I am always getting the rowHeight as 22 ( which I found wrong).
The code below I was using earlier with the Label,
<mx:AdvancedDataGridColumn backgroundColor="black" headerText="Name">
<mx:itemRenderer>
<mx:Component>
<mx:Label text="{data.getNames()}" height="{data.names.length * bodyFontsize}"/>
</mx:Component>
</mx:itemRenderer>
</mx:AdvancedDataGridColumn>
to avoid the hardcoded height I replace the Label with the text like below
where I am getting the same output.
<mx:AdvancedDataGridColumn backgroundColor="black" headerText="Name">
<mx:itemRenderer>
<mx:Component>
<mx:Text text="{data.getNames()}"/>
</mx:Component>
</mx:itemRenderer>
</mx:AdvancedDataGridColumn>
How I can calculate the rowHeight in this case?
Any suggestions would be helpful.
Thanks.