PDA

View Full Version : Grid column renders content in unwanted way



slckysr
18 Jan 2011, 3:52 AM
hi my grid has two columns where one of them will show a

html template(ex.
<div width="300" height="250"></div>)

and another column will show the

dimensions of a banner(ex. 300x250).


but the grid gives me a javascript error for the templatefield because it understands the width and height tag attributes as a dynamic setting for the extjs script.

and the second value like 300x250 is shown as 15.

slckysr
18 Jan 2011, 7:45 AM
nobody knows a solution ?

Condor
18 Jan 2011, 7:48 AM
Configure the column with:

renderer: 'htmlEncode'

slckysr
18 Jan 2011, 8:15 AM
for the dimension column too ? cause it doesnt worked for it

Condor
18 Jan 2011, 8:34 AM
No idea why it would show 15 instead of 300x250. I would have to see the code for that.

slckysr
18 Jan 2011, 11:14 PM
new Ext.grid.GridPanel({
id: 'grid',
stripeRows: true,
height: 135,
width: 600,
viewConfig:{forceFit:true},
loadMask:true,
columnLines: true,
enableHdMenu: false,
border: true,

store: store,

columns: [
{
id : 'publishername',
header : 'Publisher',
width : 140,
dataIndex: 'publishername'
},
{
header : 'Website',
width : 140,
dataIndex: 'website'
},
{
header : 'Username',
width : 100,
dataIndex: 'username'
},
{
header : 'Pass',
width : 100,
dataIndex: 'password'
},
{
header : 'Eticet',
width : 60,
dataIndex: 'placement'
},
{
header : 'Dimensions',
width : 60,
dataIndex: 'dimension'
}
],

bbar: [
'->', '-',
{
text: 'Delete all',
scope: this,
handler: function(){
store.removeAll();
}
}
]
})
and my store



var store = new Ext.data.ArrayStore({
fields: ['publishername', 'website', 'username', 'password', 'placement', 'dimension'],
indexId: 0
});

Condor
18 Jan 2011, 11:24 PM
And what is the data for this store?

slckysr
18 Jan 2011, 11:40 PM
ah of course excuse me.:

here it is


tmprec = {
publishername: Ext.getCmp('$newpublishername').getValue(),
publisherwebsite:Ext.getCmp('$newpublisherwebsite').getValue(),
username: Ext.getCmp('$newpublisherusername').getValue(),
password:Ext.getCmp('$newpublisherpassword').getValue(),
placement: Ext.getCmp('$placement').getValue(),
dimension: Ext.getCmp('$zonetypelist').getValue()
};

r = new addpublishersstore.recordType(tmprec, ++recid2); // create new record
addpublishersstore.insert(0,r);
this is the insert code

and this is the value which i get from the combo box for dimension

300x250 its a simple string

Condor
18 Jan 2011, 11:46 PM
I don't see why the grid wouldn't simply show 300x250!

ps. width:60 is a bit small. It won't show the entire string.

slckysr
18 Jan 2011, 11:59 PM
i set the width to 100 just for try but doesnt seem to has an effect :(

where can i find the default renderers ?

Condor
19 Jan 2011, 12:11 AM
The default renderers are methods of Ext.util.Format.

slckysr
19 Jan 2011, 12:47 AM
ok for now i get a solution with adding '' singlequotes at begin of the value, now its okay but will later check for a better solution,

thanks for your help Condor