I have the usual data pass开发者_高级运维ed into my onItemDisclosure as below:
onItemDisclosure: function(record, btn, index) {
console.log(record.data);
}...
I can see the data no problems but I would like to pass this data onto my panel so its template can then use it?
How would I go about this.
I have this so far in the detailed panel, but with in the panel code how do I then grab this?
detailPanel.update(record.data);
UPDATE
Well having a play around it seems that I placed the data variable within the template as normal and the whole thing works
<tpl for="."><div>{name}</div></tpl>
But my Other question is that I have my json set up with a field as below:
"name"," joe bloggs",
"contacts": [
{
"home":"0844 482 5171",
"mobile":"",
"work":"0844 482 5100"
}],.....
Now I can access these if I console.log(contacts[0].mobile)
but if I place this in the template <tpl for="."><div>{contacts[0].mobile}</div></tpl>
it just simply prints out {contacts[0].mobile}
So how can I obtain this data within contacts?
Update
use <tpl for="contacts">{mobile}</tpl>
end
Add the tpl
property to the detailPanel
object, like this:
tpl:'<h1>{text}</h1>'
where text
is some property of the record.data
object.
Here are some good tutorials about sencha's templates:
http://www.sencha.com/learn/xtemplates-part-i/
http://www.sencha.com/learn/xtemplates-part-ii/
精彩评论