View Full Version : How do I display a data contains "<" and/or ">" character in my grid?

26 Dec 2010, 11:03 PM
Simple, i have a data which is contains "<" and/or ">" character, for example:

"group_id": "1",
"group_name": "<Michael>",
"cpu": "100.00"

I thought that's why my grid won't display the "group name" field value.

I just add the tpl config object + html encode inside grid's column model, but it doesn't works

,tpl: '<tpl for=".">{group_name:htmlEncode}</tpl>'

Any idea?

Thx before.

26 Dec 2010, 11:23 PM
Never heard of html encoding? http://en.wikipedia.org/wiki/Character_encodings_in_HTML
online html encoding: http://www.opinionatedgeek.com/dotnet/tools/htmlencode/encode.aspx

26 Dec 2010, 11:35 PM
@devtig: yes, i did.
But, did extjs has a solution to solve this issue using some config object maybe?
Or i have to manually encode/decode them from scratch?

26 Dec 2010, 11:36 PM
How did you end up with such a strange tpl?

I would use the column renderer instead:

renderer: 'htmlEncode'

27 Dec 2010, 12:11 AM
it works! thx condor!