PDA

View Full Version : GridPanel - How to show HTML tags?



epi82
15 Sep 2010, 9:19 AM
Hello,

in my GridPanel with remote store from mysql db, I have to show a field with HTML tags.

Now my grid display this value with HTML tags, you can see an example here:
22425

How can I render the HTML tag in the column?
These HTML tags are written directly in the db by a rich text editor (tinyMCE).


Thank you.

Animal
15 Sep 2010, 9:34 AM
Use a renderer which encodes the HTML

epi82
15 Sep 2010, 9:53 AM
Can you show me an example of a renderer function for encode HTML?

Thank you.

Animal
15 Sep 2010, 10:38 AM
http://dev.sencha.com/deploy/ext-3.3-beta1-6976/docs/?class=Ext.util.Format&member=htmlEncode

epi82
16 Sep 2010, 1:43 AM
Hello,

I've done this... and works good!


var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{id:'termine', header: "Termine", width: 400, sortable: true, dataIndex: 'termine', filter:{ }},
{id:'argomento', header: "Argomento", width: 400, sortable: true, renderer: arg, dataIndex: 'argomento', filter:{ }}
],
bbar: new Ext.PagingToolbar({
pageSize: 15,
store: store,
displayInfo: true,
plugins: [new Ext.ux.ProgressBarPager()]
}),
plugins: [filterRow],

tbar: tbar,
height:660,
width:1010,
frame:true,
title:
'<div align="center"><img src="images/bannermicologia.png" alt="" border="0"></div>',
renderTo: "grid-example"
});

function arg(val){
return Ext.util.Format.htmlDecode(val);
}

Thank you!