annotate app/controller/Kommentare.js @ 55:4fa3fba50f79

Added dialog for editing kommentare. Open the dialog on double click on a kommentar in the kommentarlist.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 28 May 2013 11:39:14 +0200
parents 3c7bfff8bd64
children 9e23eca8dfc7
rev   line source
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
1 Ext.define('Lada.controller.Kommentare', {
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
2 extend: 'Ext.app.Controller',
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
3 views: [
55
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
4 'kommentare.List',
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
5 'kommentare.Edit'
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
6 ],
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
7 stores: [
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
8 'Kommentare'
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
9 ],
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
10 models: [
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
11 'Kommentar'
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
12 ],
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
13 init: function() {
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 console.log('Initialising the Kommentare controller');
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 this.control({
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
16 // CSS like selector to select element in the viewport. See
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
17 // ComponentQuery documentation for more details.
55
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
18 'kommentarelist': {
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
19 // Map Doubleclick on rows of the probenlist.
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
20 itemdblclick: this.editKommentar
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
21 }
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
22 //'probenedit button[action=save]': {
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
23 // click: this.updateProbe
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
24 //}
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
25 });
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
26 },
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
27 editKommentar: function(grid, record) {
55
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
28 console.log('Double click on ' + record.get('id'));
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
29 // Create new window to edit the seletced record.
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
30 var view = Ext.widget('kommentaredit');
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
31 var form = view.down('form');
4fa3fba50f79 Added dialog for editing kommentare. Open the dialog on double click on a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
32 form.loadRecord(record);
54
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
33 },
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
34 updateKommentar: function(button) {
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
35 //console.log('Click save');
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
36 //// We only have a reference to the button here but we really wnat to
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
37 //// get the form and the window. So first get the window and form and
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
38 //// the the record an values.
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
39 //var win = button.up('window');
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
40 //var form = win.down('form');
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
41 //var record = form.getRecord();
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
42 //var values = form.getValues();
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
43
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
44 //record.set(values);
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
45 //win.close();
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
46 //// synchronize the store after editing the record
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
47 //// NOTE: The function 'getProbenStore' will be generated
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
48 //// dynamically based on the Name of the configured Store!!!
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
49 //this.getProbenStore().sync();
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
50 }
3c7bfff8bd64 Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
51 });

http://lada.wald.intevation.org