SenchaTouch ListView 在视口中?
在过去的几个小时里,我一直在努力弄清楚如何让它发挥作用,但我很挣扎。
我目前正在尝试制作一个具有四个选项卡按钮的应用程序,每个选项卡按钮都有自己的视口 js 文件,这工作正常,但是在其中一个视图上我需要显示列表视图。
这是我到目前为止所拥有的,
MobileApp.views.Settings_screen = Ext.extend(Ext.List, {
title: "Settings ",
iconCls: "settings",
layout: 'fit',
initComponent: function() {
MobileApp.listPanel = new Ext.List({
id: 'indexlist',
store: MobileApp.listStore,
itemTpl: 'div class="contact">{firstName} {lastName}</div>'
});
},
items: [MobileApp.listPanel],
});
Ext.reg('settings_screen', MobileApp.views.Settings_screen);
但是当我运行应用程序并单击设置选项卡栏按钮时,屏幕上没有显示任何内容。
任何帮助将不胜感激。
谢谢亚伦
I have been trying to figure out for the past few hours how to get this working and I am struggling.
I'm currently trying to make an application which has four tab buttons, each one having it's own viewport js file, this works fine, however on one of the views I need to show a list view.
This is what I have so far,
MobileApp.views.Settings_screen = Ext.extend(Ext.List, {
title: "Settings ",
iconCls: "settings",
layout: 'fit',
initComponent: function() {
MobileApp.listPanel = new Ext.List({
id: 'indexlist',
store: MobileApp.listStore,
itemTpl: 'div class="contact">{firstName} {lastName}</div>'
});
},
items: [MobileApp.listPanel],
});
Ext.reg('settings_screen', MobileApp.views.Settings_screen);
However when I run the application and click on the settings tab bar button nothing appears on the screen.
Any help would be much appreciated.
Thanks Aaron
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我只能对您发布的代码发表评论,因此我无法告诉您标签栏是否有问题 - 但是这个
Settings_screen
有一些问题...如果您要要包含您自己的
initComponent
函数,您需要从您的initComponent
函数中调用其超类的initComponent
函数...就像您的情况一样..另一个问题是你正在创建
MobileApp.listPanel
在initComponent
函数中,因此您不能像您尝试的那样将其包含在items
数组中...而是摆脱它items 属性全部放在一起,并在创建后在initComponent
函数中使用this.add(MobileApp.listPanel)
。您还需要更改Settings_screen以扩展Ext.Panel,您不向List组件添加List组件,您需要有一个容器..无论是另一个面板还是您的视口容器的主体..
无论这些更改是否足以使其正常工作将取决于您未发布的代码是否存在问题。
I can only comment on the code you've posted so I can't tell you if there is something wrong with your tab bar-- this
Settings_screen
however has some problems...If you're going to include your own
initComponent
function you need to call theinitComponent
function of its superclass from within yourinitComponent
function... like this in your case..The other problem is you're creating
MobileApp.listPanel
inside theinitComponent
function so you can't include it in theitems
array like you're trying... instead get rid of the items property all together and usethis.add(MobileApp.listPanel)
from within theinitComponent
function after you've created it.You also need to change Settings_screen to extend Ext.Panel, you don't add a List component to a List component, you need to have a container.. Whether it be another panel or the body of your viewport container..
Whether these changes are enough to get it working will depend on whether there are problems with code you didn't post.