开发者

SenchaTouch ListView within a viewport?

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜