PDA

View Full Version : Panel.load doesn't use tpl if available



dolittle
5 Dec 2010, 2:34 PM
Hi,

When a panel has a tpl config set, I would expect it to use the template when calling load.
Instead, the panel just render the response string in the body without using the template.

example:

var p = new Ext.Panel({
title: 'My Panel',
collapsible:true,
renderTo: 'panel-basic',
width:400,
tpl: [
'<span>name: {name}</span>',
'<span>age: {age}</span>'
]
});

p.load({
url: '/user/5'
});

Instead I need something like:

p.load({
url: '/user/5',
callback: function(el, success, response, options) {
p.update(response);
}
});

Am I missing something?

Condor
6 Dec 2010, 1:07 AM
'update' needs to be called with JSON data and not with the response object, e.g.

var data = Ext.decode(response.responseText);
p.update(data);