PDA

View Full Version : Is there any way to avoid special characters in Grid group headers???



vasanth.kvj
15 Feb 2013, 8:26 AM
I'm trying to group grid based on the column Name and am getting broken HTML.

Tried with escape, HTML encode/decode but still the issue exists. Is there any utility method available to overcome this issue?

added also to - http://jsfiddle.net/89xDT/




var store = Ext.create('Ext.data.Store', {
storeId:'employeeStore',
fields:['name', 'seniority', 'department'],
groupField: 'department',
data: {'employees':[
{ "name": "Michael Scott", "seniority": 7, "department": "Management" },
{ "name": "~!@#$%$^^&&*()_+|}{\":?><,./;'[]\/", "seniority": 2, "department": "Sales" },
{ "name": "Jim Halpert", "seniority": 3, "department": "Sales" },
{ "name": "Kevin Malone", "seniority": 4, "department": "Accounting" },
{ "name": "Angela Martin", "seniority": 5, "department": "Accounting" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'employees'
}
}
});

Ext.create('Ext.grid.Panel', {
title: 'Employees',
store: Ext.data.StoreManager.lookup('employeeStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Seniority', dataIndex: 'seniority' }
],
features: [{ftype:'grouping'}],
width: 200,
height: 275,
renderTo: Ext.getBody()
});

sword-it
15 Feb 2013, 11:50 PM
Hi vasanth,

Try the following code-


columns: [
{ text: 'Name', dataIndex: 'name', renderer:function(value,metadata,record){
return value.replace(/[_\W]+/g, "-");
}
},
{ text: 'Seniority', dataIndex: 'seniority' }
],

working sample example- http://jsfiddle.net/maneeshgo/tzsh8/

vasanth.kvj
16 Feb 2013, 12:14 AM
Hi Sword, Thanks for your effort. Tried the link provided and still the messy html code exists.

attached image.4189141892