PDA

View Full Version : load data from a file to form



maren
25 Aug 2009, 1:32 AM
hi
I try to load data from a file to a form,this method work perfectly:



Ext.onReady(function(){
Ext.app.REMOTING_API.enableBuffer = 100;
Ext.Direct.addProvider(Ext.app.REMOTING_API);

var form = new Ext.FormPanel({

frame: true,
// url:'instal.jsp',
title:'Informations',

width: 500,
renderTo:document.body,
labelWidth: 180,
defaults: {
width: 300
},
defaultType: 'textfield',
items: [
{

fieldLabel: 'Actual Database url',
disabled:true,
name: 'databaseurl'
},
{

// fieldLabel: 'Actual Database url',
xtype :'fieldset',
name: 'information',
defaultType: 'textfield',
width:485,
items:[

{

fieldLabel: 'Database Name',
name: 'database'
},

{
fieldLabel: 'server',
name: 'server'
},
{
fieldLabel: 'Port',
name: 'port'
},

{
fieldLabel: 'User',
name: 'login'
},
{
fieldLabel: 'Password',
name: 'pwd'
}
]
}

],
api: {

load: PropertiesRead.getConnectInfo,
submit: PropertiesRead.updateConnectInfo
},
buttons: [
{
text: "Submit",

handler: function(){
form.getForm().submit({

success: function(){
Ext.Msg.alert('Status', 'Insert Successful!');

}

});
}
},
{
text: "Reset",
handler: function(){
form.getForm().reset();
}
}
]

});

form.getForm().load();


});
i try now to use this method but it doesn't work:


Sphereform.DatabaseInfos = Ext.extend(Ext.form.FormPanel, {
initComponent : function() {
Ext.apply(this, {
frame: true,
url: Ext.app.PROVIDER_BASE_URL,
title:'Informations',

width: 500,

labelWidth: 180,
defaults: {
width: 200
},
defaultType: 'textfield',
items: [
{

fieldLabel: 'Actual Database url',
disabled:true,
name: 'databaseurl'
},
{

// fieldLabel: 'Actual Database url',
xtype :'fieldset',
name: 'information',
defaultType: 'textfield',
width:485,
items:[

{

fieldLabel: 'Database Name',
name: 'database'
},

{
fieldLabel: 'server',
name: 'server'
},
{
fieldLabel: 'Port',
name: 'port'
},

{
fieldLabel: 'User',
name: 'login'
},
{
fieldLabel: 'Password',
name: 'pwd'
}
]
}

],
api: {

load: PropertiesRead.getConnectInfo,
submit: PropertiesRead.updateConnectInfo
},
buttons: [
{
text: "Submit",
scope:this,
handler: function(){
this.getForm().submit({

success: function(){
Ext.Msg.alert('Status', 'Insert Successful!');

}

});
}
},
{
text: "Reset",
scope:this,
handler: function(){
this.getForm().reset();
}
}
]

});

Sphereform.DatabaseInfos.superclass.initComponent.apply(this, arguments);
},
onRender: function() {
this.getForm().load({waitMsg:'Loading'});

Sphereform.DatabaseInfos.superclass.onRender.apply(this, arguments);
}
});

Ext.reg('DatabaseInfos', Sphereform.DatabaseInfos);
thanks for help