Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get a <div> tag htmlText to wrap inside an AdvancedDataGridColumn
    text
    copied!<p>To display HTML formatted text in an AdvancedDataColumn, I'm using a custom renderer which is an mx:Text object. I'm setting myText.htmlText to something like "test text which is really a lot longer than the column width". No matter what properties I set though, the text just runs off the end of the column. </p> <p>I tried wordWrap="true" on the dataGrid and also on each individual column. I also tried messing with css and tried applying it to the text field, but nothing seems to show up. Has anyone been able to wrap htmlText in a text object? </p> <p>Also, but slightly less important, there are extra blank lines after each tag which I would like to get rid of.</p> <p>--Edit--added renderer code.</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;!-- itemrenderers/sparkmx/myComponents/SummaryRenderer.mxml --&gt; &lt;s:MXAdvancedDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" textAlign="center"&gt; &lt;fx:Script&gt; &lt;![CDATA[ import mx.controls.advancedDataGridClasses.AdvancedDataGridListData; override public function set data(value:Object):void { // help for style sheets //http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/StyleSheet.html //create and initialize css var myCSS:StyleSheet = new StyleSheet(); myCSS.setStyle("p", {textAlign:'left'}); // TODO try wordwrap here. myCSS.setStyle("div", {textAlign:'left'}); //ensure html support and apply css to it myText.styleSheet = myCSS; // if the value is null, it would throw an error. if (AdvancedDataGridListData(listData) != null) { myText.htmlText = value[AdvancedDataGridListData(listData).dataField]; } } ]]&gt; &lt;/fx:Script&gt; &lt;mx:Text id="myText"/&gt; &lt;/s:MXAdvancedDataGridItemRenderer&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload