PDA

View Full Version : Problem grid.panel



Elfayer
16 Aug 2012, 2:31 AM
Hi,

Here is the problem :
38000

Why the Description take one line and the HTML is fully visible? I would like the HTML to be on one line too.

Here is the grid.panel code :


Ext.define('ADM.view.News', {
extend: 'Ext.grid.Panel',
alias: 'widget.News',

store: 'News',
id: 'gridNews',
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 2
})
],
columns: [{
header: '<center>Label</center>',
dataIndex: 'new_label',
align: 'center',
flex: 1,
sortable: true,
hideable: false,
field: { xtype: 'textfield' }
}, {
header: '<center>Description</center>',
dataIndex: 'new_description',
align: 'center',
flex: 1,
sortable: true,
hideable: false,
field: { xtype: 'textfield' }
}, {
header: '<center>HTML</center>',
dataIndex: 'new_html',
align: 'center',
flex: 1,
sortable: true,
hideable: false
}, {
header: '<center>Date Start</center>',
dataIndex: 'new_start_date',
align: 'center',
flex: 0.5,
sortable: true,
hideable: false,
renderer: Ext.util.Format.dateRenderer('d-m-Y'),
field: { xtype: 'datefield' }
}, {
header: '<center>Date End</center>',
dataIndex: 'new_end_date',
align: 'center',
flex: 0.5,
sortable: true,
hideable: false,
renderer: Ext.util.Format.dateRenderer('d-m-Y'),
field: { xtype: 'datefield' }
}],
dockedItems: [{
xtype: 'toolbar',
dock: 'bottom',
items: [
{ text: 'Add', itemId: 'addNews' },
'-',
{ text: 'Set HTML', itemId: 'setNewsHTML' },
'-',
{ text: 'Save', itemId: 'saveNews' }
]
}]
})

Thanks in advance !

redraid
16 Aug 2012, 2:39 AM
You can strip html tags in column renderer:


{
header: '<center>HTML</center>',
dataIndex: 'new_html',
align: 'center',
flex: 1,
sortable: true,
hideable: false,
renderer: Ext.util.Format.stripTags
}

sword-it
16 Aug 2012, 3:16 AM
Hi,

you can use following code :



{
header: '<center>Html</center>',
dataIndex: 'new_html' ,
align:'center',
flex:1,
renderer:function(v,m,r){ return Ext.util.Format.htmlEncode(v);}
}



For more detail see this link: http://docs.sencha.com/ext-js/4-1/#!/api/Ext.util.Format-method-htmlEncode