changeset 6:8e79bda4d55b

Added a list to select predefined SQL Statement for the Proben list.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Mon, 29 Apr 2013 15:18:26 +0200
parents 039584709fa7
children 54f95ab2f375
files app.js app/controller/Sql.js app/view/sql/List.js
diffstat 3 files changed, 53 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/app.js	Mon Apr 29 15:10:43 2013 +0200
+++ b/app.js	Mon Apr 29 15:18:26 2013 +0200
@@ -8,7 +8,7 @@
             layout: 'fit',
             items: [
                 {
-                    xtype: 'probenlist',
+                    xtype: 'sqllist',
                     title: 'Probenauswahlmaske'
                 }
             ]
@@ -17,6 +17,7 @@
     // Define the controllers of the application. They will be initialized
     // first before the application "launch" function is called.
     controllers: [
-        'Proben'
+        'Proben',
+        'Sql'
     ]
 });
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controller/Sql.js	Mon Apr 29 15:18:26 2013 +0200
@@ -0,0 +1,25 @@
+Ext.define('Lada.controller.Sql', {
+    extend: 'Ext.app.Controller',
+    views: [
+        'sql.List'
+    ],
+    init: function() {
+        console.log('Initialising the Sql controller');
+        this.control({
+            // CSS like selector to select element in the viewport. See
+            // ComponentQuery documentation for more details.
+            'viewport > sqllist': {
+                // Map the "render" event to the given function.
+                render: this.onPanelRendered,
+                // Map Doubleclick on rows of the probenlist.
+                itemclick: this.selectSql
+            }
+        });
+    },
+    onPanelRendered: function() {
+        console.log('The panel was rendered');
+    },
+    selectSql: function(grid, record) {
+        console.log('Selected SQL ' + record.get('id'));
+    }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/sql/List.js	Mon Apr 29 15:18:26 2013 +0200
@@ -0,0 +1,25 @@
+Ext.define('Lada.view.sql.List' ,{
+    extend: 'Ext.grid.Panel',
+    alias: 'widget.sqllist',
+
+    title: 'SQL-Auswahl',
+
+    initComponent: function() {
+        this.store = {
+            fields: ['id', 'name', 'description', 'sql'],
+            data  : [
+                {'id': '1', 'name': 'MST, UWB', 'description': 'Beschreibung der MST, UWB Abfrage', 'sql': 'select * from xxx'},
+                {'id': '2', 'name': 'Rbegin', 'description': 'Beschreibung der Rbegin Abfrage', 'sql': 'select * from xxx'}
+            ]
+        };
+
+        this.columns = [
+            {header: 'ID',  dataIndex: 'id',  flex: 1},
+            {header: 'Kurzname', dataIndex: 'name', flex: 1},
+            {header: 'SQL', dataIndex: 'desc', flex: 1}
+        ];
+
+        this.callParent(arguments);
+    }
+});
+

http://lada.wald.intevation.org