fix cancel button

This commit is contained in:
Sebastian Sdorra
2010-11-29 21:18:22 +01:00
parent d620c64083
commit 91f630a03c
3 changed files with 32 additions and 25 deletions

View File

@@ -394,16 +394,11 @@ Sonia.repository.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
});
},
reset: function(){
cancel: function(){
if ( debug ){
console.debug( 'reset form' );
}
this.getForm().reset();
if ( this.item != null ){
this.permissionStore.loadData( this.item );
} else {
this.permissionStore.removeAll();
console.debug( 'cancel form' );
}
Sonia.repository.setEditPanel( Sonia.repository.DefaultPanel );
}
});

View File

@@ -152,7 +152,7 @@ Sonia.rest.FormPanel = Ext.extend(Ext.FormPanel,{
buttonAlign: 'center',
buttons: [
{text: 'Ok', formBind: true, scope: this, handler: this.submit},
{text: 'Cancel', scope: this, handler: this.reset}
{text: 'Cancel', scope: this, handler: this.cancel}
]
}
@@ -182,7 +182,7 @@ Sonia.rest.FormPanel = Ext.extend(Ext.FormPanel,{
}
},
reset: function(){
cancel: function(){
if ( debug ){
console.debug( 'reset form' );
}

View File

@@ -32,6 +32,26 @@
// register namespace
Ext.ns('Sonia.user');
// functions
Sonia.user.setEditPanel = function(panel){
var editPanel = Ext.getCmp('userEditPanel');
editPanel.removeAll();
editPanel.add(panel);
editPanel.doLayout();
}
// Panels
Sonia.user.DefaultPanel = {
region: 'south',
title: 'User Form',
padding: 5,
xtype: 'panel',
html: 'Add or select an User'
};
// UserGrid
Sonia.user.Grid = Ext.extend(Sonia.rest.Grid, {
@@ -74,8 +94,6 @@ Sonia.user.Grid = Ext.extend(Sonia.rest.Grid, {
if ( debug ){
console.debug( item.name + ' selected' );
}
var editPanel = Ext.getCmp('userEditPanel');
editPanel.removeAll();
var panel = new Sonia.user.FormPanel({
item: item,
region: 'south',
@@ -94,8 +112,7 @@ Sonia.user.Grid = Ext.extend(Sonia.rest.Grid, {
{id: 'password', value: dummyPassword},
{id: 'password-confirm', value: dummyPassword}
]);
editPanel.add(panel);
editPanel.doLayout();
Sonia.user.setEditPanel(panel);
}
});
@@ -211,6 +228,10 @@ Sonia.user.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
alert( 'failure' );
}
});
},
cancel: function(){
Sonia.user.setEditPanel( Sonia.user.DefaultPanel );
}
});
@@ -282,16 +303,7 @@ Sonia.user.Panel = Ext.extend(Ext.Panel, {
},
resetPanel: function(){
var editPanel = Ext.getCmp('userEditPanel');
editPanel.removeAll();
editPanel.add({
region: 'south',
title: 'User Form',
padding: 5,
xtype: 'panel',
html: 'Add or select an User'
});
editPanel.doLayout();
Sonia.user.setEditPanel( Sonia.user.DefaultPanel );
},
removeUser: function(){