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
基础教程推荐
猜你喜欢
- 逻辑运算符 ||在 javascript 中,0 代表 Boolean false? 2022-01-01
- 带角度的选项卡:仅使用 $http 在单击时加载选项卡 2022-01-01
- 使用 jQuery 在悬停时交换 DIV 类 2022-01-01
- 即使每次插入第一个输入的值不同,第二个输入仍显示相同的输入值 2022-01-01
- HTML5 画布调整为父级 2022-01-01
- 从快速中间件中排除路由 2022-01-01
- CORS:当凭据标志为真时,无法在 Access-Control-Allow-Origin 中使用通配符 2022-01-01
- 在 Javascript 中使用 Fetch API 上传文件并显示进度 2022-01-01
- 最佳动态 JavaScript/JQuery 网格 2022-01-01
- 当木偶师打开Chrome时,不能使用Chrome扩展 2022-01-01
