Sencha Touch TPL and ITEM(Sencha Touch TPL和Item)
本文介绍了Sencha Touch TPL和Item的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
让我解释一下我的问题,我有一个从存储文件加载一些元素的列表视图,当我单击一个列表项时,我有一个控制器在新的详细信息视图中推送数据
'placesContainer places list':{
itemtap: function(list,index,target,record) {
console.log("item "+record.get('name')+" pigiato");
var detailsView = Ext.create('MyApp.view.Details');
this.getPlacesContainer().push(detailsView);
detailsView.setData(record.data);
}
}
好的在这里。现在,我想要的是从我的新详细信息视图中的存储文件加载相同的信息。 以下是我的详细信息视图:
Ext.define('MyApp.view.Details',{
extend:'Ext.Panel',
xtype:'details',
config:{
layout:'vbox',
scrollable:true,
styleHtmlContent:true,
styleHtmlCls:'details',
tpl:'<h1>{name}</h1>' +
'<p><span>Lunghezza:</span> {lunghezza} <span>Difficoltà:</span> {difficulty}</p>' +
'<h2>{prova}</h2>',
items: [
{
xtype: 'panel',
flex:1,
store:'Places',
},
{
xtype: 'carousel',
flex:2,
items: [
{style: "background-color: #7BB300"},
{style: "background-color: #555555"},
{style: "background-color: #00ff2a"},
{style: "background-color: #00bb1f"},
{style: "background-color: #008616"},
{style: "background-color: #00490c"}
]
}
]
}
如果我在项之外编写TPL元素,我可以在详细信息视图中读取数据。当我尝试将TPL元素放入项中时,所有数据都消失了。怎么了? 我尝试了这种方法,但没有结果...
items: [
{
xtype: 'panel',
flex:1,
store:'Places',
tpl:'<h1>{name}</h1>' +
'<p><span>Lunghezza:</span> {lunghezza} <span>Difficoltà:</span> {difficulty}</p>' +
'<h2>{prova}</h2>',
},
items: [
{
xtype: 'panel',
flex:1,
store:'Places',
itemTpl:'<h1>{name}</h1>' +
'<p><span>Lunghezza:</span> {lunghezza} <span>Difficoltà:</span> {difficulty}</p>' +
'<h2>{prova}</h2>',
},
能帮上忙就太好了!
推荐答案
您需要对您的itemtap
函数进行小规模更改
'placesContainer places list':{
itemtap: function(list,index,target,record) {
console.log("item "+record.get('name')+" pigiato");
var detailsView = Ext.create('MyApp.view.Details');
this.getPlacesContainer().push(detailsView);
detailsView.setData(record.data); // will set data to detailsview
detailsView.getAt(0).setData(record.data); // will set data to first component in items array
detailsView.getAt(1).setData(record.data); // will set data to second component in items array
.... and so ....
}
}
这篇关于Sencha Touch TPL和Item的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:Sencha Touch TPL和Item


猜你喜欢
- 400或500级别的HTTP响应 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01