Sencha touch 2 两个列表相同的容器相同的存储
在这个类中,我试图显示来自同一容器中同一存储区的一些数据。我这样做是因为我想在一个单独的行上各有两行,而我没有这样做 对他们的控制太多了。下面是课程:Sencha touch 2 两个列表相同的容器相同的存储,sencha-touch-2,Sencha Touch 2,在这个类中,我试图显示来自同一容器中同一存储区的一些数据。我这样做是因为我想在一个单独的行上各有两行,而我没有这样做 对他们的控制太多了。下面是课程: Ext.define('Clue.view.ListQuestions', { extend: 'Ext.Container', requires: ['Ext.dataview.List'], xtype: 'listquestions', config: { id: 'listquestions', items: [{
Ext.define('Clue.view.ListQuestions', {
extend: 'Ext.Container',
requires: ['Ext.dataview.List'],
xtype: 'listquestions',
config: {
id: 'listquestions',
items: [{
xtype: 'list',
id: 'questionLi1',
baseCls: 'questionLi1',
flex: 1,
store: {
xtype: 'levelstore',
filters: [{
filterFn: function(item) {
return item.data.levelId < 2 && item.data.questionId < 6;
}
}]
},
itemTpl: '<div>{questionId}</div>'
},{
xtype: 'list',
id: 'questionLi2',
baseCls: 'questionLi2',
flex: 1,
store: {
xtype: 'levelstore',
filters: [{
filterFn: function(item) {
return item.data.levelId < 2 && item.data.questionId > 5;
}
}]
},
itemTpl: '<div>{questionId}</div>'
}]
}
})
其他详细信息
我在问题1和问题2及其条目上添加了一些css。3件红色边框。列表占用了空间,但在第一个列表中元素不存在(甚至在html中也不存在),第二个列表呈现良好。如果在第一个filterFn函数中放入console.log(),则不会显示任何内容。。所以我在想也许我覆盖了一些东西
这就是我得到的
如果我这样做了:
...
flex: 1,
/*store: {
xtype: 'levelstore',
filters: [{
filterFn: function(item) {
return item.data.levelId < 2 && item.data.questionId > 5;
}
}]
},*/
itemTpl: '<div>{questionId}</div>'
...
。。。
弹性:1,
/*商店:{
xtype:'levelstore',
过滤器:[{
过滤器Fn:功能(项目){
返回item.data.levelId<2和item.data.questionId>5;
}
}]
},*/
itemTpl:“{questionId}”
...
在我得到的第二份名单上
只有在将hbox布局的vbox指定给其父级时,才能将flex配置添加到组件中
Ext.create('Ext.Container', {
fullscreen: true,
layout: 'vbox',
items: [{
xtype: 'list',
itemTpl: '{title}',
flex: 1,
data: [
{ title: 'List 1: Item 1' },
{ title: 'List 1: Item 2' },
{ title: 'List 1: Item 3' },
{ title: 'List 1: Item 4' }
]
}, {
xtype: 'list',
itemTpl: '{title}',
flex: 1,
data: [
{ title: 'List 2: Item 1' },
{ title: 'List 2: Item 2' },
{ title: 'List 2: Item 3' },
{ title: 'List 2: Item 4' }
]
}]
});
在你的集装箱中添加布局:“vbox”我认为屏幕截图会很好。查看更新后的帖子。事实并非如此。不管怎样,你在布局方面是对的。我将编辑我的问题以作进一步解释。
Ext.create('Ext.Container', {
fullscreen: true,
layout: 'vbox',
items: [{
xtype: 'list',
itemTpl: '{title}',
flex: 1,
data: [
{ title: 'List 1: Item 1' },
{ title: 'List 1: Item 2' },
{ title: 'List 1: Item 3' },
{ title: 'List 1: Item 4' }
]
}, {
xtype: 'list',
itemTpl: '{title}',
flex: 1,
data: [
{ title: 'List 2: Item 1' },
{ title: 'List 2: Item 2' },
{ title: 'List 2: Item 3' },
{ title: 'List 2: Item 4' }
]
}]
});