PDA

View Full Version : How get a Template from Ext.grid.TemplateColumn



grubby69
9 Aug 2011, 11:49 PM
Hi,
I wish to understand how can I get the component Xtemplate from a Column of a Grid.

This is my code :


MyPanelUi = Ext.extend(Ext.Panel, {
title: 'PIM',
width: 787,
height: 410,
initComponent: function() {
this.items = [
{
xtype: 'grid',
title: 'To Do List',
store: 'ToDoListStore',
height: 234,
width: 736,
id: 'idToDoListGrid',
columns: [
{
xtype: 'datecolumn',
dataIndex: 'DDATA',
header: 'Data',
sortable: true,
width: 80,
id: 'idData'
},
{
xtype: 'gridcolumn',
dataIndex: 'TINFO',
header: 'Info',
sortable: true,
width: 200,
id: 'idInfo'
},
{
xtype: 'gridcolumn',
dataIndex: 'VUSER',
header: 'User',
sortable: true,
width: 100,
id: 'idUser'
},
{
xtype: 'templatecolumn',
header: 'Template',
sortable: true,
width: 350,
tpl: [
'<div id="mio">',
' <p>Ciao</p>',
' <p><b>{nome} {cognome}</p>',
' <p>Vai su <a href="www.google.it">Google</a></p>',
'</div>'
],
id: 'idTemplate'
}
]
}
];
MyPanelUi.superclass.initComponent.call(this);
}
});


I want to get my idTemplate and pass it new value from a Data Store in 'nome' and 'cognome' to test the functionality of an Xtemplate in a Grid.

I have try this :


MyPanel = Ext.extend(MyPanelUi, {
initComponent: function() {
MyPanel.superclass.initComponent.call(this);

var grid = Ext.getCmp('idToDoListGrid');
var tpl = grid.get('idTemplate');

var data = {
nome: "Alberto",
cognome: "Bottarini",
};
tpl.append("mio", data);
}
});


but Firebug say me :


this.items is undefined

chrome://firebug/content/blank.gif return this.items.get(comp);



How is it???
How to get the Xtemplate and work on it???

Thanks bye!~o)

grubby69
10 Aug 2011, 11:06 PM
up