How can I add dynamically an new item in Ext.panel ? 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'});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With