Mercurial > lada > lada-client
changeset 17:3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
the selected sql query.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Tue, 30 Apr 2013 17:55:48 +0200 |
parents | 4faac2a04345 |
children | 9e1a40312bbe |
files | app.js app/controller/Sql.js data/proben.json |
diffstat | 3 files changed, 162 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/app.js Tue Apr 30 16:37:41 2013 +0200 +++ b/app.js Tue Apr 30 17:55:48 2013 +0200 @@ -11,10 +11,52 @@ // Viewport.js class. Ext.create('Ext.panel.Panel', { renderTo: Ext.getBody(), - title: 'Probenauswahlmaske', - items: [ + title: '<center>Probenauswahlmaske</center>', + items:[ { - xtype: 'probenlist' + xtype: 'panel', + id: 'searchSelection', + border: false, + padding: '10 10 10 10', + items: [ + // 1. SQL-Selection + // 1.1 Just a small texttual field + { + xtype: 'displayfield', + padding : '10 0', + fieldLabel: '<b>SQL-Auswahl</b>' + }, + // 1.2 Selection of prepared sql statements + { + xtype: 'sqllist' + } + ] + }, + { + xtype: 'panel', + id: 'searchVariables', + hidden: true, + border: false, + padding: '10 10 10 10', + items: [ + // 2. Variable-Definition. Depending on the SQL-Selection we + // need to show a small form to be able to diefine some values + // within the preselected Search-statement. + // 2.1 Just a small texttual field + { + xtype: 'displayfield', + padding : '10 0', + fieldLabel: '<b>Variablenbelegung (Zeiten in UTC)</b>', + labelWidth: 500 + } + + ] + }, + { + xtype: 'probenlist', + id: 'searchResult', + hidden: true, + padding: '10 10 10 10' } ] });
--- a/app/controller/Sql.js Tue Apr 30 16:37:41 2013 +0200 +++ b/app/controller/Sql.js Tue Apr 30 17:55:48 2013 +0200 @@ -11,7 +11,7 @@ this.control({ // CSS like selector to select element in the viewport. See // ComponentQuery documentation for more details. - 'viewport > sqllist': { + 'sqllist': { // Map the "render" event to the given function. render: this.onPanelRendered, // Map Doubleclick on rows of the probenlist. @@ -23,6 +23,42 @@ console.log('The panel was rendered'); }, selectSql: function(grid, record) { - console.log('Selected SQL ' + record.get('id')); + var selection = record.get('id'); + var variables = Ext.getCmp('searchVariables'); + console.log('Selected SQL' + selection); + // Set correct form for the current SQL-Selection + console.log('Length is ' + variables.items.length); + if (variables.items.length > 1) { + console.log('Length is > than 1'); + variables.remove(currentVar.id); + } + if (selection == 1) { + currentVar = variables1; + } + else { + currentVar = variables2; + } + variables.add(currentVar); + // Show the panel for the variable definiton. + variables.show(); + + // Show the results. + Ext.getCmp('searchResult').show(); } }); + + +var currentVar = null; +var variables1 = { + xtype: 'panel', + id: 'variable1', + border: false, + html: 'Variablen für Abfrage 1' +}; + +var variables2 = { + xtype: 'panel', + id: 'variable2', + border: false, + html: 'Variablen für Abfrage 2' +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data/proben.json Tue Apr 30 17:55:48 2013 +0200 @@ -0,0 +1,79 @@ +{ + "proben": [ + { + "datenbasisId": 2, + "probeId": "000007581034X", + "hauptprobenNr": "120510002", + "mplId": null, + "letzteAenderung": 1339570306000, + "lkommentarPs": [], + "media": "Trinkwasser Zentralversorgung Oberfl\u00e4chenwasser aufbereitet", + "solldatumBeginn": 1336341600000, + "solldatumEnde": 1336939199000, + "probeNehmerId": 726, + "mpKat": "1", + "mstId": "06010", + "test": false, + "erzeugerId": null, + "mprId": 3749, + "mittelungsdauer": null, + "netzbetreiberId": "06", + "umwId": "N72", + "probeentnahmeBeginn": 1336467600000, + "baId": "1", + "mediaDesk": "D: 59 04 01 00 05 05 01 02 00 00 00 00", + "probenartId": 1, + "probeentnahmeEnde": null + }, + { + "datenbasisId": 2, + "probeId": "000007581036X", + "hauptprobenNr": "120224003", + "mplId": null, + "letzteAenderung": 1331279424000, + "lkommentarPs": [], + "media": "Trinkwasser Zentralversorgung Oberfl\u00e4chenwasser aufbereitet", + "solldatumBeginn": 1328482800000, + "solldatumEnde": 1329080399000, + "probeNehmerId": 726, + "mpKat": "1", + "mstId": "06010", + "test": false, + "erzeugerId": null, + "mprId": 3748, + "mittelungsdauer": null, + "netzbetreiberId": "06", + "umwId": "N72", + "probeentnahmeBeginn": 1328517000000, + "baId": "1", + "mediaDesk": "D: 59 04 01 00 05 05 01 02 00 00 00 00", + "probenartId": 1, + "probeentnahmeEnde": null + }, + { + "datenbasisId": 2, + "probeId": "000007581040X", + "hauptprobenNr": "120515001", + "mplId": null, + "letzteAenderung": 1338376872000, + "lkommentarPs": [], + "media": "Trinkwasser Zentralversorgung Grundwasser aufbereitet", + "solldatumBeginn": 1336341600000, + "solldatumEnde": 1336939199000, + "probeNehmerId": 716, + "mpKat": "1", + "mstId": "06010", + "test": false, + "erzeugerId": null, + "mprId": 3746, + "mittelungsdauer": null, + "netzbetreiberId": "06", + "umwId": "N71", + "probeentnahmeBeginn": 1336640400000, + "baId": "1", + "mediaDesk": "D: 59 03 01 01 02 05 01 02 00 00 00 00", + "probenartId": 1, + "probeentnahmeEnde": null + } + ] +}