开发者

Sencha Touch add dynamically items

How can I add dynamically an new item in Ext.pane开发者_JAVA百科l ? This is the code I'm using;

app.views.ViewItem = Ext.extend(Ext.Panel, {
    id: '0',
    dockedItems: [{
        xtype: 'toolbar',
        title: 'Melvin test',
        items: [
            {
                text: 'Terug',
                ui: 'back',
                listeners: {
                    'tap': function () {
                        Ext.dispatch({
                            controller: app.controllers.appController,
                            action: 'backToRssList',
                            animation: {type:'slide', direction:'right'}
                        });
                    }
                }
            },
            {xtype:'spacer'},
            {
                id: 'share',
                text: 'Delen',
                ui: 'action',
                listeners: {
                    'tap': function () {
                        Ext.dispatch({
                            controller: app.controllers.appController,
                            action: 'share',
                        });
                    }
                }
            }
        ]
    }],
    items: [],
    initComponent: function() { 
        app.views.ViewItem.superclass.initComponent.apply(this, arguments); 
    },
    getView: function(data) {
        //this.items.add({html: 'test'});
    },
});

In the function getView I am trying to add an new item with this line;

this.items.add({html: 'test'});

The error that is showing up ( in Rockmelt, Chrome ) is;

Uncaught TypeError: Object #<Object> has no method 'getItemId'

Obviously this isn't working, what am I doing wrong?


Did you try using the add() function for the panel itself? E.g:

this.add({html: 'test'});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜