Any idea why the docked items not displayed in the preview? Here is the code.
Ext.setup({
onReady:function(){
var top_toolbar= [{
xtype:'toolbar',
ui:'dark',
dock:'top',
title:'Login Form'
}]
var loginForm = new Ext.form.FormPanel({
items:[{
xtype:'fieldset',
items:[{
xtype:'textfield',
label:'Username',
name:'u_name',
labelWidth:100
},{
xtype:'passwordfield',
label:'Password',
name:'u_password',
labelWidth:100
}]
}]
});
var formPanel=new Ext.Panel({
fullscreen:'true',
layout:'fit',
dockedItems:top_toolbar,
items:[loginForm]
});
}
});
I am just trying to create a login page, with the textfields for username and password and need to include the toolbar docked on top which has the title 'Login Form'. In the preview i get the textfields with label but it does not show the toolbar. am I doing anything wrong with the code?
Any help would be appreciated. Thanks in advance.
The dockedItems
configuration has been deprecated in Sencha Touch 2. If you are using a version of the framework which does not include the compatibility layer, that configuration will not work.
Instead, put all items, including docked items, inside the items
array.
Some other notes:
dock
has been changed to docked
Ext.form.FormPanel
has changed to Ext.form.Panel
Ext.create()
instead of the the new
keyword. This means you can take advantage of Ext.Loader and dependency management. You can find our more information about it here: http://docs.sencha.com/touch/2-0/#!/guide/class_systemAnd finally, here is how your code should look if you implement all these changes:
Ext.setup({
onReady:function(){
var loginForm = Ext.create('Ext.form.Panel', {
items: [
{
xtype: 'fieldset',
items: [
{
xtype: 'textfield',
label: 'Username',
name: 'u_name',
labelWidth: 100
},
{
xtype: 'passwordfield',
label: 'Password',
name: 'u_password',
labelWidth: 100
}
]
}
]
});
var formPanel = Ext.create('Ext.Panel', {
fullscreen:'true',
layout:'fit',
items: [
{
xtype: 'toolbar',
ui: 'dark',
docked: 'top',
title: 'Login Form'
},
loginForm
]
});
}
});
Hope this helps.