Hi All,
I have a problem showing my form in a window. If I have my code set up below, I get a this.el has no properties when I open it.
If I put the form in the Window, which I like better, the form displays correctly, but I don't know how to get the data loaded into the form in the window.
When I create the form in can use, dWin.getComponent('newForm').getForm().load({url:'/My/Address.do?dId='+dId, waitMsg:'Loading'});
How do you load the data in a form defined in a window.
Code:
function newForm() {
return new Ext.form.FormPanel({
id: 'newform',
frame:true,
autoScroll: true,
autoWidth: true,
reader: EditReader,
defaults: {width: 775},
title: 'Entry Form',
items:
[{
id:'rCols',
//region: 'center',
layout:'column',
bodyStyle: 'padding-top:0px; padding-left:0px; padding-right:5px; background-color:#F4FBED',
items:
[{
id: 'colR1',
columnWidth:.5,
layout: 'form',
bodyStyle: 'padding-top:0px; padding-left:0px; padding-right:5px; background-color:#F4FBED',
labelWidth:150,
items: [ {
id: 'R1',
xtype: 'textfield',
name: 'Field1',
fieldLabel: 'Field1',
disabled: false,
grow: false,
width: '150',
growMin: '75',
growMax: '200',
allowBlank:false
},{
id: 'R2',
xtype: 'datefield',
name: 'Field2',
fieldLabel: 'Field2'
//width: 165
}]
},{
id: 'col-1row-2',
columnWidth:.5,
layout: 'form',
bodyStyle: 'padding-top:0px; padding-left:0px; padding-right:5px; background-color:#F4FBED',
labelWidth:150,
items: [ {
id: 'R3',
xtype: 'textfield',
name: 'Field3',
fieldLabel: 'Field3',
disabled: false,
grow: true,
growMin: '50',
growMax: '200',
allowBlank:false
},{
id: 'R4',
xtype: 'textfield',
name: 'Field4',
fieldLabel: 'Field4',
disabled: false,
grow: false,
growMin: '150',
growMax: '150',
allowBlank:false
}]
}]
}]
});
}
==========================================================
//WINDOW
var rWin;
this.rWindow = function () {
if (!rWin) {
logger.trace("In fWindow");
//----
rWin = new Ext.Window(
{
id: 'rWindow',
layout:'fit',
width:850,
height:500,
title: '40-1 Entry/Edit Form',
closable: false,
closeAction:'hide',
plain: true,
items: rForm()
});
}
//rWin.doLayout();
rWin.show(Ext.getBody());
};
If I put the form in the Window, which I like better, the form displays correctly. How do you load data in the form?
Code:
var rWin;
this.rWindow = function () {
if (!rWin) {
logger.trace("In fWindow");
//----
rWin = new Ext.Window(
{
id: 'rWindow',
layout:'fit',
width:850,
height:500,
title: '40-1 Entry/Edit Form',
closable: false,
closeAction:'hide',
plain: true,
items: [{
[{ // Item element 1
//=========================================================================
xType: 'panel',
id:'rCols',
//region: 'center',
layout:'column',
bodyStyle: 'padding-top:0px; padding-left:0px; padding-right:5px; background-color:#F4FBED',
items:
///////////////////////////////////////////
[{
id: 'colR1',
columnWidth:.5,
layout: 'form',
bodyStyle: 'padding-top:0px; padding-left:0px; padding-right:5px; background-color:#F4FBED',
labelWidth:150,
items: [ {
id: 'R1',
xtype: 'textfield',
name: 'Field1',
fieldLabel: 'Field1',
disabled: false,
grow: false,
width: '150',
growMin: '75',
growMax: '200',
allowBlank:false
},{
id: 'R2',
xtype: 'datefield',
name: 'Field2',
fieldLabel: 'Field2'
//width: 165
}]
},{
id: 'col-1row-2',
columnWidth:.5,
layout: 'form',
bodyStyle: 'padding-top:0px; padding-left:0px; padding-right:5px; background-color:#F4FBED',
labelWidth:150,
items: [ {
id: 'R3',
xtype: 'textfield',
name: 'Field3',
fieldLabel: 'Field3',
disabled: false,
grow: true,
growMin: '50',
growMax: '200',
allowBlank:false
},{
id: 'R4',
xtype: 'textfield',
name: 'Field4',
fieldLabel: 'Field4',
disabled: false,
grow: false,
growMin: '150',
growMax: '150',
allowBlank:false
}]
}]
///////////////////////////////////////////
}]
});
}
//rWin.doLayout();
rWin.show(Ext.getBody());