Results 1 to 6 of 6

Thread: Ext JS 6 modern grid column renderer no html support

  1. #1
    Sencha User
    Join Date
    Jul 2015
    Posts
    11

    Default Ext JS 6 modern grid column renderer no html support

    Hello,

    I have a problem with the grid column renderer method with html return value in Ext JS 6 modern toolkit, the renderer method always returns only string value, for example: '<span style="color:red">nothing there</span>' and not the red text.

    Is this a bug? Or does the modern toolking not support this feature? In classic toolkit I'm using renderer with html return value with no problem.

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256
    Answers
    759

    Default

    See: http://docs.sencha.com/extjs/6.0/6.0...cfg-encodeHtml

    To override it globally:

    Code:
    Ext.define('GiveMeHtml', {
        extend: 'Ext.grid.cell.Text',
        encodeHtml: false
    });
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha User
    Join Date
    Jul 2015
    Posts
    11

    Default

    No, it doesn't work, still there are only the tags, not rendered html. Here is my code:

    Code:
    columns: [{ 	 	text: 'Type', 
    	    	dataIndex: 'type', 
    	    	width: 150, 
    	    	cell: {
    	    		xtype: 'textcell',
    	    		encodeHtml: false,
    	    		align: 'center'	    		
    	    	} 
    }]
    and this is an example from store for data field type:

    Code:
    <b>hi there</b>

  4. #4
    Sencha Premium Member
    Join Date
    Nov 2007
    Posts
    22

    Default

    if you set the xtype to gridcell rather than textcell the above will work.

  5. #5
    Sencha User Daniil's Avatar
    Join Date
    Jun 2010
    Location
    Saint-Petersburg, Russia
    Posts
    1,018
    Answers
    1

    Default

    Just noticed that Evan's global override doesn't work. I guess Evan meant this:
    Code:
    Ext.define('GiveMeHtml', {
        override: 'Ext.grid.cell.Text',
        config: {
            encodeHtml: false
        }
    });
    Object.NET
    Frameworks and Tools for .NET Developers
    --------------------------------------------------
    Ext.NET - Ext JS for ASP.NET - Examples | Twitter
    Bridge.NET - Write C#. Run JavaScript! - Live | Twitter
    --------------------------------------------------

  6. #6
    Sencha - Support Team keckeroo's Avatar
    Join Date
    Mar 2008
    Location
    Winnipeg, Canada
    Posts
    388
    Answers
    13

    Default

    The correct way to achieve this is to configure the cell itself by including
    the following property in your column configuration along with the renderer :

    Code:
              cell: {
                  encodeHtml: false
              },
              renderer: function (v) {
                  return '<a href="mailto:' + v + '">' + v + '</a>';
              }
    Kevin

Similar Threads

  1. Ext 6 Modern - Ext.grid.column.Column not obeying flex
    By laurencek in forum Ext JS 6.x Q&A
    Replies: 5
    Last Post: 15 Sep 2015, 7:12 PM
  2. [FIXED] 4.2.1 - Ext.tree.Column.renderer doesn't support string.
    By Alex Chen in forum Ext:Bugs
    Replies: 1
    Last Post: 29 Jul 2013, 7:17 AM
  3. Grid column renderer with html tag
    By paipai in forum Ext: 4.x Beta
    Replies: 3
    Last Post: 24 Jan 2013, 7:09 AM
  4. Returning an element instead of HTML from Ext.grid.Column.renderer()?
    By tysontate in forum Ext 3.x: Help & Discussion
    Replies: 7
    Last Post: 14 Jul 2010, 10:36 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •