PDA

View Full Version : [FIXED-300][3.0] Problem with Ext.util.Format.stripTags



cnelissen
6 Oct 2009, 3:45 PM
Seeing something strange with stripTags. Here is an example:

This does not work, but clearly should.



var cm = new Ext.grid.ColumnModel({
columns: [
{header: 'Some HTML', dataIndex: 'html', renderer: Ext.util.Format.stripTags}}
]
});


This however does work fine.



var cm = new Ext.grid.ColumnModel({
columns: [
{header: 'Some HTML', dataIndex: 'html', renderer: function(value) { return Ext.util.Format.stripTags(value)}}
]
});


Looks like a bug to me, but I might be missing something...

Condor
7 Oct 2009, 12:36 AM
Yes, I would consider this a bug.

The Ext.util.Format methods need to be scope independent (they shouldn't use 'this').

I recommend:

Ext.apply(Ext.util.Format, {
stripTags : function(v){
return !v ? v : String(v).replace(Ext.util.Format.stripTagsRE, "");
},
stripScripts : function(v){
return !v ? v : String(v).replace(Ext.util.Format.stripScriptsRe, "");
}
});

ps. Did you know that you can also specify your renderer as a string (e.g. renderer: 'stripTags')?

evant
15 Oct 2009, 10:03 PM
Fix applied to svn in rev #5499 for patch release 3.1.