tags:

views:

40

answers:

2

in Flex Datagrid, I need to support line wrap function in one column. In theory I need to set wordWrap="true" and variableRowHeight="true". It works well.

But the problem is that if in the cloumn I set itemRenderer="lc.monitoring.logviewer.components.CustomColumnRenderer" properties, then the line wrap funciton does not take effect. It seems that the line wrap function can not work with itemRenderer in the datagrid column.

Any one can help me about this.

A: 

You should try to override measure and updateDisplaylist inside your itemrenderer. Your item renderer does not know how to resize the height in order to allow showing info inside the dg

Adrian Pirvulescu
Your said make sense, but I do not know how to implement it. Could you give me some detail example about this?Thanks
Adrian Pirvulescu
Adrian Pirvulescu
you need to compute the needed size for the control to be displayed.I also recommend you to take a look at the flex DataGridItemRenderer class definition and mechanism. you can find it in package mx.controls.dataGridClasses and explore the code there :)
Adrian Pirvulescu
+1  A: 

Don't use Label - it is for displaying a single line of text.

The Label control displays a single line of noneditable text. Use the Text control to create blocks of multiline noneditable text.

mx.controls.Text supports multiline text and wordwrap

If the control is not as wide as the text, the text will wordwrap. The text is always aligned top-left in the control.

Amarghosh
Hi Amarghosh, after I changed it to Text, it work well.Great thank your help!!!
@user In that case you might want to [read this](http://meta.stackoverflow.com/questions/5234/how-does-accepting-an-answer-work)
Amarghosh