[Lada-commits] [PATCH 12 of 56] Inherit from Base controller
Wald Commits
scm-commit at wald.intevation.org
Tue Aug 13 09:53:38 CEST 2013
# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1376053207 -7200
# Node ID 529da633b8e375022504144b227336fc48a1637b
# Parent 841dc60824b5c3434442ff45e51121cf33e10d0a
Inherit from Base controller
diff -r 841dc60824b5 -r 529da633b8e3 app/controller/Zusatzwerte.js
--- a/app/controller/Zusatzwerte.js Fri Aug 09 15:00:07 2013 +0200
+++ b/app/controller/Zusatzwerte.js Fri Aug 09 15:00:07 2013 +0200
@@ -1,5 +1,5 @@
Ext.define('Lada.controller.Zusatzwerte', {
- extend: 'Ext.app.Controller',
+ extend: 'Lada.controller.Base',
views: [
'zusatzwerte.Create'
],
@@ -10,9 +10,10 @@
],
init: function() {
console.log('Initialising the Zusatzwerte controller');
+ this.callParent();
+ },
+ addListeners: function() {
this.control({
- // CSS like selector to select element in the viewpzusatzwert. See
- // ComponentQuery documentation for more details.
'zusatzwertelist': {
itemdblclick: this.editZusatzwert
},
@@ -35,11 +36,6 @@
}
});
},
- saveZusatzwert: function(button) {
- console.log('Saving Zusatzwert');
- var form = button.up('window').down('form');
- form.commit();
- },
addZusatzwert: function(button) {
console.log('Adding new Zusatzwert for Probe' + button.probeId);
var zusatzwert = Ext.create('Lada.model.Zusatzwert');
@@ -53,27 +49,6 @@
view.down('probenzusatzwert').disabled = true;
console.log("Loaded Zusatzwert with ID " + record.getId()); //outputs ID
},
- deleteZusatzwert: function(button) {
- // Get selected item in grid
- var grid = button.up('grid');
- var selection = grid.getView().getSelectionModel().getSelection()[0];
- Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){
- if(btn === 'yes'){
- var store = grid.getStore();
- var deleteUrl = selection.getProxy().url + selection.getEidi();
- Ext.Ajax.request({
- url: deleteUrl,
- method: 'DELETE',
- success: function(response, opts) {
- store.reload();
- }
- });
- console.log('Deleting Kommentar');
- } else {
- console.log('Cancel Deleting Kommentar');
- }
- });
- },
createSuccess: function(form, record, operation) {
// Reload store
var store = this.getZusatzwerteStore();
@@ -81,27 +56,11 @@
var win = form.up('window');
win.close();
},
- createFailure: function(form, record, operation) {
- Ext.MessageBox.show({
- title: 'Fehler beim Speichern',
- msg: form.message,
- icon: Ext.MessageBox.ERROR,
- buttons: Ext.Msg.OK
- });
- },
editSuccess: function(form, record, operation) {
// Reload store
var store = this.getZusatzwerteStore();
store.reload();
var win = form.up('window');
win.close();
- },
- editFailure: function(form, record, operation) {
- Ext.MessageBox.show({
- title: 'Fehler beim Speichern',
- msg: form.message,
- icon: Ext.MessageBox.ERROR,
- buttons: Ext.Msg.OK
- });
}
});
More information about the Lada-commits
mailing list