We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

valueAccessor can not render html

Thread ID:





150690 Jan 16,2020 08:55 AM UTC Jan 20,2020 07:34 AM UTC JavaScript - EJ 2 3
Tags: Grid
Asked On January 16, 2020 08:55 AM UTC

Hi :
             In the   previous  version(EJ2.min.js) ,the column property "valueAccessor " can render string to html , but in the newest version, it didn't work, how can i solve this problem ? 

var grid1 = new ej.grids.Grid({
    dataSource: customerData,
    Offline: true
    columns: [
                { field: 'cid'headerText: '會員編號'textAlign: 'center'width: 200type: 'string' },
                { field: 'name'width: 80headerText: '姓名'type: 'string' },
                { field: 'gender'headerText: '性別'textAlign: 'left'width: 100format: 'string' },
                { field: 'email'headerText: '電子郵件'textAlign: 'left'width: 120format: 'string' },
                { field: 'age'headerText: '聯絡地址'textAlign: 'left'width: 100format: 'string' },
                { field: 'tags'headerText: '標籤'textAlign: 'left'width: 160format: 'string',valueAccessor: tagsFormatter},
                { field: 'guid'headerText: '跨域識別碼'textAlign: 'left'width: 120format: 'string'},
    rowHeight: 20,
    //enableVirtualization: true,
    //enableColumnVirtualization: true,
    height: 750,
    allowPaging: true,
    pageSettings: { pageSize: 8 },
    allowSorting: true,
    //queryCellInfo: customiseCell
function tagsFormatter(fielddatacolumn){
    var tmp_Str = data.tags;
    var tmp_Str2='';
    var rtn_Str='';
    var arr = tmp_Str.split(",");  
    for(var i=0;i<arr.length;i++){
        tmp_Str2='<span class="tagStyles tag-info  m-r-5 m-t-5">'+arr[i]+'</span>';
    return rtn_Str;

Attachment: Desktop_ea46a4df.zip

Thiyagu Subramani [Syncfusion]
Replied On January 17, 2020 10:17 AM UTC

Hi Adrian, 
Greetings from Syncfusion forum. 

We have validated your requirement at our end. Previously, Html tags are converted from string to html . But now value will be updated what type of text will be entered in the grid because there is no form of conversion performed in grid.  

Please refer the below release notes for more information. 

If you need html conversion in specific column you can achieve by setting disableHtmlEncode as false in column level. Please refer to the below code and sample link. 

    var grid = new ej.grids.Grid({ 
        columns: [ 
            { field: 'OrderID', headerText: 'Order ID', width: 120, textAlign: 'Right' }, 
            { field: 'CustomerName', headerText: 'Customer Name', width: 150, disableHtmlEncode:false
 valueAccessor: valueAccess }, 
. . . . . 

function valueAccess(field, data, column) { 
    return '<span>CustomerName</span>' 

Please get back to us, if you need any further assistance. 

Thiyagu S. 

Replied On January 19, 2020 12:27 AM UTC

Thanks ,you help me a lot .

Balaji Sekar [Syncfusion]
Replied On January 20, 2020 07:34 AM UTC

Hi Adrian, 
We glad that your issue has been fixed.  
Please get back to us if you require further other assistance from us. 
Balaji Sekar. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon