简体   繁体   中英

Display special characters in mx:AdvancedDataGrid flex

I am trying to display special characters in a column of mx:AdvancedDataGridColumn as value. For example, i am trying to display copy right symbol, trademark and other characters with HTML code.

I want to display below data


Special Characters: ¢ ©® ™

with below html encoded content:

<b>Special Characters:</b> ¢ ©® ™

As of now mx:AdvancedDataGridColumn displays the data as is. That is displays the tags (HTML encoded string as is)

sample code: < mx:AdvancedDataGridColumn dataField="htmlContent" >

Here HTML can be anything. Please adivse how to do this.

By default, when you specify the dataField property, Flex will try to set the "text" property of the default AdvancedDataGridItemRenderer (which is a TextField). In order to display html, you need to create a custom item renderer extending AdvancedDataGridItemRenderer, and overriding the "set data" function, then set the htmlText property instead.

Also see http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#htmlText , some HTML entities are not supported.

I setted Delta symbol to column header of DataGrid like this

<s:DataGrid width="100%" height="100%" rowHeight="43"
            sortableColumns="false"
            color="0x929698"
            borderVisible="false"
            dataProvider="{model.gridOperationDataCollection}">
    <s:columns>
        <s:ArrayList>
            <s:GridColumn> headerRenderer="ru.prognoz.iup.renderers.OperationIndGridHRDelta"/>
        </s:ArrayList>
    </s:columns>

OperationIndGridHRDelta

<s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx"
                minWidth="21" minHeight="21">

<mx:Text htmlText="\u0394 {label}"
         color="0xA2ACB2"
         verticalCenter="0" horizontalCenter="0"
         fontSize="12" fontFamily="Arial"
        />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM