SenchaTouch ListView 在视口中?

发布于 2024-12-01 17:06:53 字数 729 浏览 0 评论 0原文

在过去的几个小时里,我一直在努力弄清楚如何让它发挥作用,但我很挣扎。

我目前正在尝试制作一个具有四个选项卡按钮的应用程序,每个选项卡按钮都有自己的视口 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱你不解释 2024-12-08 17:06:53

我只能对您发布的代码发表评论,因此我无法告诉您标签栏是否有问题 - 但是这个 Settings_screen 有一些问题...

如果您要要包含您自己的 initComponent 函数,您需要从您的 initComponent 函数中调用其超类的 initComponent 函数...就像您的情况一样..

initComponent: function() {
  MobileApp.views.Settings_screen.superclass.initComponent.call(this);
}

另一个问题是你正在创建MobileApp.listPanelinitComponent 函数中,因此您不能像您尝试的那样将其包含在 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 the initComponent function of its superclass from within your initComponent function... like this in your case..

initComponent: function() {
  MobileApp.views.Settings_screen.superclass.initComponent.call(this);
}

The other problem is you're creating MobileApp.listPanel inside the initComponent function so you can't include it in the items array like you're trying... instead get rid of the items property all together and use this.add(MobileApp.listPanel) from within the initComponent 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文