mask form on load

This commit is contained in:
Sebastian Sdorra
2010-09-19 18:43:16 +02:00
parent 20c21bc5d7
commit 5326622e75
2 changed files with 24 additions and 12 deletions

View File

@@ -23,34 +23,39 @@ registerConfigPanel({
}],
onSubmit: function(values){
this.el.mask('Submit ...');
Ext.Ajax.request({
url: restUrl + 'config/repositories/hg.json',
method: 'POST',
jsonData: values,
scope: this,
disableCaching: true,
success: function(response){
alert( 'success' );
this.el.unmask();
},
failure: function(){
alert( 'failure' );
this.el.unmask();
}
});
},
onLoad: function(){
//this.getEl().mask();
onLoad: function(el){
var tid = setTimeout( function(){ el.mask('Loading ...'); }, 100);
Ext.Ajax.request({
url: restUrl + 'config/repositories/hg.json',
method: 'GET',
scope: this,
disableCaching: true,
success: function(response){
var obj = Ext.decode(response.responseText);
this.load(obj);
//this.getEl().unmask();
clearTimeout(tid);
el.unmask();
},
failure: function(){
alert( 'failure' );
//this.getEl().unmask();
el.unmask();
clearTimeout(tid);
alert('failure');
}
});
}

View File

@@ -61,6 +61,14 @@ Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, {
layoutConfig : {
labelSeparator : ''
},
listeners: {
render: function(){
if ( this.onLoad != null && Ext.isFunction( this.onLoad ) ){
this.onLoad(this.el);
}
},
scope: this
},
items: this.items,
buttons: [{
text: 'Save',
@@ -78,14 +86,13 @@ Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, {
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.config.ConfigForm.superclass.initComponent.apply(this, arguments);
if ( this.onLoad != null && Ext.isFunction( this.onLoad ) ){
this.onLoad();
}
},
load: function(values){
this.getForm().loadRecord({success: true, data: values});
this.getForm().loadRecord({
success: true,
data: values
});
},
submitForm: function(){