0
我是Sencha Touch和移动应用程序开发新手。 我需要在我的应用程序来实现看起来应该和这样的表现主要观点:Sencha Touch 2:导航带级联数据视图的视图
Group1 Group2
_________________________ _________________________
Item1 Item2 Item3 Item1 Item2 Item3
Group3 Group4
_________________________ _________________________
Item1 Item2 Item3 Item1 Item2 Item3
Group5 Group6
_________________________ _________________________
Item1 Item2 Item3 Item1 Item2 Item3
...
组块胸围内联和垂直滚动。 项目必须水平滚动。 每组的项目数可能因组而异。
组存储在“storeMainNavGroups”存储中。 项目存储在“storeMainNav”商店中,该商店按......“组”分组!
我认为,它应该通过级联的数据视图来完成: 1RST级数据视图:包含组 2级数据视图:包含的项目 ,但我不知道。
这是我试过的代码,但它不起作用:所有项目(对于所有组)都显示在组上方。 代码:
Ext.define('MyApp.view.Main', {
extend: 'Ext.navigation.View',
xtype: 'main',
requires: ['Ext.data.Store'],
config: {
navigationBar : {
docked : 'top',
items : [
{
name: 'btnHome',
align: 'left',
xtype: "button",
iconCls: 'home',
ui: 'plain'
}
]
},
items: [
{
title: 'MyApp',
layout: 'vbox',
fullscreen: true,
items: [
{
xtype: 'label',
html: 'some text...'
},
{
xtype: 'dataview',
id: 'listMainNavViewGroups',
useSimpleItems: true,
grouped: true,
inline: {
wrap: true
},
flex: 1,
itemTpl: [
'<div>' +
'<div style="display: block; float: left; font-family: Pictos; font-size: 1.5em; line-height: 120%; margin: 0 20px 0 0;">{icon}</div>' +
'<span style="margin: 0 40px 0 0;">{group}</span>' +
'</div>'
],
store: 'storeMainNavGroups',
items: [
{
xtype: 'dataview',
id: 'listMainNavView',
useSimpleItems: true,
grouped: true,
height: '100px',
inline: {
wrap: false
},
flex: 1,
itemTpl: [
'<div>' +
'<div style="display: block; float: left; font-family: Pictos; font-size: 1.5em; line-height: 120%; margin: 0 20px 0 0;">{icon}</div>' +
'<span style="margin: 0 40px 0 0;">{title}</span>' +
'</div>'
],
store: 'storeMainNav'
}
]
}
]
}
]
}
});
我在做什么错? 有没有更好的解决方案来完成这个?
在此先感谢您的回答和建议。
Arnaud
嗨阿卜杜勒,感谢您的回答。你的解决方案很有趣。但是,我想让所有组的高度相同,并在每个组内水平滚动项目。事实上,我想我会变得更简单:一个分组列表,用css样式对物品进行内联...无论如何,浏览这个对于用户来说太复杂了...... – Arnaud
如果你给groupPanel一个高度(比如身高:100)在我的代码中,你会得到所有组的高度相等。将滚动设置为true将水平滚动项目,因为布局是hbox。 –