Mercurial > lada > lada-client
comparison app/controller/Proben.js @ 53:73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Tue, 28 May 2013 10:58:47 +0200 |
parents | af418743e1f4 |
children | 3c7bfff8bd64 |
comparison
equal
deleted
inserted
replaced
52:af418743e1f4 | 53:73bc17de6ff2 |
---|---|
8 'Proben', | 8 'Proben', |
9 'Uwb', | 9 'Uwb', |
10 'Datenbasis', | 10 'Datenbasis', |
11 'Probenart', | 11 'Probenart', |
12 'Betriebsart', | 12 'Betriebsart', |
13 'Testdatensatz' | 13 'Testdatensatz', |
14 'Kommentare' | |
14 ], | 15 ], |
15 models: [ | 16 models: [ |
16 'Probe' | 17 'Probe' |
17 ], | 18 ], |
18 init: function() { | 19 init: function() { |
36 }, | 37 }, |
37 editProbe: function(grid, record) { | 38 editProbe: function(grid, record) { |
38 console.log('Double click on ' + record.get('probeId')); | 39 console.log('Double click on ' + record.get('probeId')); |
39 // Create new window to edit the seletced record. | 40 // Create new window to edit the seletced record. |
40 var view = Ext.widget('probenedit'); | 41 var view = Ext.widget('probenedit'); |
41 //console.log(Ext.ModelManager.getModel('Lada.model.Probe')); | 42 var form = view.down('form'); |
42 Ext.ModelManager.getModel('Lada.model.Probe').load(record.get('probeId'), { | 43 form.loadRecord(record); |
43 success: function(record) { | 44 |
44 view.down('form').loadRecord(record); | 45 // Load kommentare |
45 console.log("Loaded probe with ID " + record.getId()); //outputs ID | 46 var kommentare = form.down('kommentarelist'); //form.down('kommentare'); |
47 var kstore = kommentare.getStore(); | |
48 kstore.load({ | |
49 params: { | |
50 probe: record.data['probeId'] | |
46 } | 51 } |
47 }); | 52 }); |
53 | |
54 // Set form data | |
55 console.log("Loaded probe with ID " + record.getId()); //outputs ID | |
48 }, | 56 }, |
49 updateProbe: function(button) { | 57 updateProbe: function(button) { |
50 console.log('Click save'); | 58 console.log('Click save'); |
51 // We only have a reference to the button here but we really wnat to | 59 // We only have a reference to the button here but we really wnat to |
52 // get the form and the window. So first get the window and form and | 60 // get the form and the window. So first get the window and form and |