PDA

View Full Version : Ext.form.Basic fails somewhere.



extjs.mscit
16 Jul 2013, 8:59 AM
I am migrating from Extjs 3.4 to 4.1.3.
All my form (more than 60) generated using following method.

Please help, what is wrong here?

At first, I decided to use Ext.form.Panel, But it is impossible to do.

Problem occures at "contentEl" property of panel.


var container = Ext.create('Ext.container.Container', {
id: "mypcontainer",
layout: {
type: 'hbox'
},
width: 400,
border: 1,
style: {borderColor:'#000000', borderStyle:'solid', borderWidth:'1px'},
items: [{
xtype: 'textfield',
name: 'startDate',
fieldLabel: 'Start date'
},{
xtype: 'textfield',
name: 'endDate',
fieldLabel: 'End date'
}]
});


form = new Ext.form.Basic (container, {
id: "myform-panel",
trackResetOnLoad: true
});

Ext.create('Ext.window.Window', {
title: 'Hello',
width: 400,
layout: 'fit',
items:[
{xtype: 'panel', border: false, autoScroll: true,
contentEl: "myform-panel",
buttonAlign: "left",
buttons: [
{ text: "show" }
]
} ]
}).show();

friend
16 Jul 2013, 9:37 AM
Are you just trying to do something like below? Note that the use of hard-coded IDs is a recipe for disaster. Instead, look into Ext.ComponentQuery (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.ComponentQuery) and the native up(), down(), child(), etc. methods supported by most components.



Ext.create('Ext.window.Window', {
bodyPadding: 5,
buttonAlign: 'left',
title: 'Hello',
width: 350,
items:[{
xtype: 'form',
defaults: {
labelAlign: 'right',
labelWidth: 60
},
layout: {
type: 'hbox',
align: 'stretch'
},
url: 'somePostURLHere',
items: [{
xtype: 'datefield',
flex: 1,
name: 'startDate',
fieldLabel: 'Start date'
},{
xtype: 'datefield',
flex: 1,
name: 'endDate',
fieldLabel: 'End date'
}]
}],
buttons: [{
text: 'Show'
}]
}).show();

extjs.mscit
16 Jul 2013, 9:40 AM
No dear, It is not feasible for me to change data this way. I means I have to follow these steps, which create Container first, then BasicForm then window.
As everything polulated from different classe.

Problem is contentEl. what shd be there in my case.

I can not make any modification as this is the way my whole project built.