Sencha touch Sencha Touch:将数据从onItemDisclosure传递到详图视图面板和样板
我已将常规数据传递到我的系统中,如下所示:Sencha touch Sencha Touch:将数据从onItemDisclosure传递到详图视图面板和样板,sencha-touch,Sencha Touch,我已将常规数据传递到我的系统中,如下所示: onItemDisclosure: function(record, btn, index) { console.log(record.data); }... "name"," joe bloggs", "contacts": [ { "home":"0844 482 5171", "mobile":"",
onItemDisclosure: function(record, btn, index) {
console.log(record.data);
}...
"name"," joe bloggs",
"contacts": [
{
"home":"0844 482 5171",
"mobile":"",
"work":"0844 482 5100"
}],.....
我可以看到数据没有问题,但我想把这些数据传递到我的面板上,这样它的模板就可以使用它了
我该怎么办呢
到目前为止,我已经在详细的面板中看到了这一点,但是在面板代码中,我如何抓住这一点呢
detailPanel.update(record.data);
更新
好了,我们来玩玩一下,似乎我把数据变量放在了模板中,一切正常,一切正常
<tpl for="."><div>{name}</div></tpl>
现在,如果我console.log(contacts[0].mobile)
可以访问这些,但是如果我将其放在模板{contacts[0].mobile}
中,它只需打印出{contacts[0].mobile}
那么如何在联系人中获取这些数据呢?更新 使用
{mobile}
结束
将tpl
属性添加到detailPanel
对象,如下所示:
tpl:'<h1>{text}</h1>'
tpl:'{text}'
其中text
是record.data
对象的某些属性
以下是一些关于sencha模板的好教程:
谢谢你的回复,我刚刚做了“{mobile}”。。。但8小时内我无法回答自己的问题:-)但谢谢你