naveedanjum
21 Nov 2011, 3:30 AM
Hi,
I am getting problem while creating my own custom panel class. This approch was working in Ext JS 3. But i dont know how to do this in Ext JS 4.
Ext.require([
'Ext.form.*',
'Ext.layout.container.Column',
'Ext.tab.Panel'
]);
Ext.ns('sample.ui');
var sampleStores = new sample.ui.stores.sampleStores();
Ext.define('sample.ui.UserProfilePanel', {
extend:'Ext.panel.Panel',
alias:'widget.userprofilepanel',
config: {
layout:'column',
width: '100%',
frame: false,
autoScroll: 'true',
items:[
this.createUserProfileFormPanel
],
title: 'Manage Data'
},
constructor:function(config) {
return this.callParent(arguments);
},
initComponent:function() {
return this.callParent(arguments);
},
createUserProfileFormPanel:function(){
this.userProfilePanel = Ext.create('Ext.panel.Panel', {
renderTo: Ext.Element.get('fullForm'),
ref: 'userProfilePanel',
title: 'User Profile',
bodyStyle:'padding:5px',
width: 930,
layout: {
type: 'table',
columns: 3
},
items:
[
{
xtype: 'textfield',
name: 'firstName',
fieldLabel: 'First Name',
labelAlign:'right',
allowBlank: false
},
{
xtype: 'textfield',
name: 'middleName',
fieldLabel: 'Middle Name',
labelAlign:'right',
allowBlank: false
},
{
xtype: 'textfield',
name: 'lastName',
fieldLabel: 'Last Name',
labelAlign:'right',
allowBlank: false
},
{
xtype: 'textfield',
name: 'fatherName',
fieldLabel: 'Father\'s Name',
width: 400,
labelAlign:'right',
colspan: 3,
allowBlank: false
},
{
xtype: 'textfield',
name: 'fatherName',
fieldLabel: 'NIC Number',
width: 400,
labelAlign:'right',
colspan: 3,
allowBlank: true
},
{
xtype: 'combo',
fieldLabel: 'Gender',
name: 'cmbGender',
ref: 'cmbGender',
store: sampleStores.createGenderStore(),
displayField :'name',
valueField :'id',
queryMode :'local',
emptyText :'Select Gender',
selectOnFocus :true,
blankText:"You didn't select Gender",
allowBlank: false,
scope: this,
labelAlign:'right',
enableKeyEvents : true,
resizable: false
},
{
xtype: 'datefield',
name: 'dateOfBirth',
fieldLabel: 'Date of Birth',
format:'d/M/Y',
labelAlign:'right',
maxValue: new Date(),
allowBlank: true
},
{
xtype: 'textfield',
name: 'residentialPhone',
fieldLabel: 'Phone',
labelAlign:'right',
allowBlank: true
},
{
xtype: 'textfield',
name: 'mobile',
fieldLabel: 'Mobile',
labelAlign:'right',
colspan: 3,
allowBlank: true
},
{
xtype: 'textarea',
name: 'streetAddress',
fieldLabel: 'Street Address',
width: 770,
colspan: 3,
labelAlign:'right',
allowBlank: true
}
],
buttons:
[
{
text: 'Save'
},
{
text: 'Cancel'
}
]
});
return this.userProfilePanel;
}
});
Ext.onReady(function(){
Ext.QuickTips.init();
var userProfilePanel = new sample.ui.UserProfilePanel();
});
I am getting problem while creating my own custom panel class. This approch was working in Ext JS 3. But i dont know how to do this in Ext JS 4.
Ext.require([
'Ext.form.*',
'Ext.layout.container.Column',
'Ext.tab.Panel'
]);
Ext.ns('sample.ui');
var sampleStores = new sample.ui.stores.sampleStores();
Ext.define('sample.ui.UserProfilePanel', {
extend:'Ext.panel.Panel',
alias:'widget.userprofilepanel',
config: {
layout:'column',
width: '100%',
frame: false,
autoScroll: 'true',
items:[
this.createUserProfileFormPanel
],
title: 'Manage Data'
},
constructor:function(config) {
return this.callParent(arguments);
},
initComponent:function() {
return this.callParent(arguments);
},
createUserProfileFormPanel:function(){
this.userProfilePanel = Ext.create('Ext.panel.Panel', {
renderTo: Ext.Element.get('fullForm'),
ref: 'userProfilePanel',
title: 'User Profile',
bodyStyle:'padding:5px',
width: 930,
layout: {
type: 'table',
columns: 3
},
items:
[
{
xtype: 'textfield',
name: 'firstName',
fieldLabel: 'First Name',
labelAlign:'right',
allowBlank: false
},
{
xtype: 'textfield',
name: 'middleName',
fieldLabel: 'Middle Name',
labelAlign:'right',
allowBlank: false
},
{
xtype: 'textfield',
name: 'lastName',
fieldLabel: 'Last Name',
labelAlign:'right',
allowBlank: false
},
{
xtype: 'textfield',
name: 'fatherName',
fieldLabel: 'Father\'s Name',
width: 400,
labelAlign:'right',
colspan: 3,
allowBlank: false
},
{
xtype: 'textfield',
name: 'fatherName',
fieldLabel: 'NIC Number',
width: 400,
labelAlign:'right',
colspan: 3,
allowBlank: true
},
{
xtype: 'combo',
fieldLabel: 'Gender',
name: 'cmbGender',
ref: 'cmbGender',
store: sampleStores.createGenderStore(),
displayField :'name',
valueField :'id',
queryMode :'local',
emptyText :'Select Gender',
selectOnFocus :true,
blankText:"You didn't select Gender",
allowBlank: false,
scope: this,
labelAlign:'right',
enableKeyEvents : true,
resizable: false
},
{
xtype: 'datefield',
name: 'dateOfBirth',
fieldLabel: 'Date of Birth',
format:'d/M/Y',
labelAlign:'right',
maxValue: new Date(),
allowBlank: true
},
{
xtype: 'textfield',
name: 'residentialPhone',
fieldLabel: 'Phone',
labelAlign:'right',
allowBlank: true
},
{
xtype: 'textfield',
name: 'mobile',
fieldLabel: 'Mobile',
labelAlign:'right',
colspan: 3,
allowBlank: true
},
{
xtype: 'textarea',
name: 'streetAddress',
fieldLabel: 'Street Address',
width: 770,
colspan: 3,
labelAlign:'right',
allowBlank: true
}
],
buttons:
[
{
text: 'Save'
},
{
text: 'Cancel'
}
]
});
return this.userProfilePanel;
}
});
Ext.onReady(function(){
Ext.QuickTips.init();
var userProfilePanel = new sample.ui.UserProfilePanel();
});