PDA

View Full Version : Items in Items ... in TabPanel



giraffezw
8 Sep 2010, 12:02 AM
Hi,

I have a window with a TabPanel. In Tab1 there is a GridPanel, in Tab2 a FormPanel. The Grid works fine, but if i add ,items: [] to the FormPanel i get the follow error in firebug
this.items.add is not a function
this.items.add(c);
even if the items are blank!

heres the code:


Ext.kv73.UserPanel = Ext.extend(Ext.form.FormPanel, {
id: 'newUserForm'
,bodyBorder: false
,title: currentUserName
,autoHeight: true
,bodyStyle:'padding:10px;'
,params: {
create: 'Anlegen'
}
,items: [{
layout: 'column'
,border: false
,items: [{
layout: 'form'
,columnWidth: .7
,border: false
,items: [{
xtype: 'textfield'
,fieldLabel: 'Benutzername'
,allowBlank: false
,value: currentUserName
,disabled: true
,name: 'userName'
,anchor: '100%'
},{
xtype: 'textfield'
,fieldLabel: 'Firma'
,allowBlank: false
,name: 'firm'
,anchor: '100%'
},{
xtype: 'textfield'
,fieldLabel: 'Anrede'
,allowBlank: false
,name: 'title'
,anchor: '100%'
},{
xtype: 'textfield'
,fieldLabel: 'Vorname'
,allowBlank: false
,name: 'firstName'
,anchor: '100%'
},{
xtype: 'textfield'
,fieldLabel: 'Name'
,allowBlank: false
,name: 'lastName'
,anchor: '100%'
},{
xtype: 'textfield'
,fieldLabel: 'Durchwahl'
,allowBlank: false
,name: 'phone'
,anchor: '100%'
},{
xtype: 'textfield'
,fieldLabel: 'ZimmerNr'
,allowBlank: false
,name: 'roomNr'
,anchor: '100%'
},{
xtype: 'textfield'
,fieldLabel: 'Info'
,allowBlank: true
,name: 'info'
,anchor: '100%'
}
//,picBox
]
}]
,buttons:[{
text: 'Speichern'
,formBind: true
,iconCls: 'icon-add'
,handler : function() {
this.createNewUser()
}
,scope: this
}]
}]
,listeners: {
//removed
}
});
Ext.reg('userPanel', Ext.kv73.UserPanel);
previously I wrote the FormPanel in a variable and add it to the TabPanel. With exactly the same setting and it has worked

If I completely remove items, it works again :-?
I overlook something? hope someone can help me

Condor
8 Sep 2010, 12:08 AM
You should NOT put complex objects (params, items) in the Ext.kv73.UserPanel prototype.

Instead, assign them in the initComponent method.

giraffezw
8 Sep 2010, 12:13 AM
you're just great =D> thx