[英]Using list in container or panel in sencha touch
I am learning sencha touch. 我正在学习煎茶触感。 I am facing an issue while using xtype:'list', in a container.
我在容器中使用xtype:'list'时遇到问题。 ie it does not show anything to me .
即它没有向我显示任何东西。 My code is:
我的代码是:
{
xtype:'container',
items:[
{
xtype: 'list',
id: 'lists',
fields: [{name:'name'}],
store: {
data: [
{name: 'Cowper'},
{name: 'Everett'},
{name: 'University'},
{name: 'Forest'}
]
},
itemTpl: '<div>{name}</div>'
}
],
}
Kindly point out where i am wrong ?? 请指出我错了吗?? Any help would be great :) Thanks in advance.
任何帮助将是巨大的:)预先感谢。
I think it is solved when you add: 我认为添加时可以解决:
layout: 'fit'
to your container. 到您的容器。 This config sizes its child components.
此配置调整其子组件的大小。
Note that list is actually a container. 请注意,列表实际上是一个容器。 Try to minimize your nesting.
尽量减少嵌套。
Take a look at the fullscreen config too. 也来看看全屏配置。
The issue is in your code. 问题出在您的代码中。 Try this -
尝试这个 -
Ext.create('Ext.List', {
fullscreen: true,
id:'lists',
itemTpl: '<div>{name}</div>',
data: [
{name: 'Cowper'},
{name: 'Everett'},
{name: 'University'},
{name: 'Forest'}
]
});
OR 要么
Ext.define('TestModel', {
extend: 'Ext.data.Model',
config: {
fields: ['name']
}
});
var store = Ext.create('Ext.data.Store', {
model: 'TestModel',
data: [
{name: 'Cowper'},
{name: 'Everett'},
{name: 'University'},
{name: 'Forest'}
]
});
Ext.create('Ext.List', {
fullscreen: true,
id:'lists',
itemTpl: '<div>{name}</div>',
store: store
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.