changeset 28:4d60b9ebce15

Renamed sql modul into search. Further display The query selection as Combobox instead of a grid.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Thu, 16 May 2013 17:55:53 +0200
parents e02d07abc4fe
children 1fdef170d5a5
files app/controller/Sql.js app/store/Proben.js app/view/Viewport.js app/view/search/List.js app/view/search/Variables.js app/view/sql/List.js app/view/sql/Variables.js
diffstat 7 files changed, 66 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Sql.js	Fri May 10 12:24:45 2013 +0200
+++ b/app/controller/Sql.js	Thu May 16 17:55:53 2013 +0200
@@ -1,7 +1,7 @@
 Ext.define('Lada.controller.Sql', {
     extend: 'Ext.app.Controller',
     views: [
-        'sql.List'
+        'search.List'
     ],
     stores: [
         'Sql'
@@ -11,19 +11,20 @@
         this.control({
             // CSS like selector to select element in the viewport. See
             // ComponentQuery documentation for more details.
-            'sqllist': {
+            'queryselector': {
                 // Map the "render" event to the given function.
                 render: this.onPanelRendered,
                 // Map Doubleclick on rows of the probenlist.
-                itemclick: this.selectSql
+                select: this.selectSql
             }
         });
     },
     onPanelRendered: function() {
         console.log('The panel was rendered');
     },
-    selectSql: function(grid, record) {
-        var selection = record.get('id');
+    selectSql: function(element, record, index) {
+        //var selection = record.get('id');
+        var selection = index;
         var variables = Ext.getCmp('variables');
         var result = Ext.getCmp('result');
         console.log('Selected SQL ' + selection);
@@ -44,7 +45,9 @@
         //variables.show();
 
         // Show the results.
+        console.log('Loading store');
         result.getStore().load();
+        console.log('Store loaded');
         result.show();
     }
 });
--- a/app/store/Proben.js	Fri May 10 12:24:45 2013 +0200
+++ b/app/store/Proben.js	Thu May 16 17:55:53 2013 +0200
@@ -4,7 +4,7 @@
     proxy: {
         type: 'ajax',
         api: {
-            read: 'server/rest/proben'
+        read: 'server/rest/proben'
         },
         reader: {
             type: 'json'
--- a/app/view/Viewport.js	Fri May 10 12:24:45 2013 +0200
+++ b/app/view/Viewport.js	Thu May 16 17:55:53 2013 +0200
@@ -1,8 +1,8 @@
 Ext.define('Lada.view.Viewport' ,{
     extend: 'Ext.container.Viewport',
     requires: [
-        'Lada.view.sql.List',
-        'Lada.view.sql.Variables',
+        'Lada.view.search.List',
+        'Lada.view.search.Variables',
         'Lada.view.proben.List'
     ],
     initComponent: function() {
@@ -13,7 +13,7 @@
             bodyPadding: '10 10',
             items: [
                 {
-                    xtype: 'sqllist',
+                    xtype: 'queryselector',
                     margin: '0 0 10 0'
                 },
                 // Variables settings for the current selected sql statement.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/search/List.js	Thu May 16 17:55:53 2013 +0200
@@ -0,0 +1,31 @@
+Ext.define('Lada.view.search.List' ,{
+        extend: 'Ext.form.ComboBox',
+        alias: 'widget.queryselector',
+        store: 'Sql',
+        displayField:'name',
+        valueField: 'id' ,
+        emptyText:'Wählen Sie eine Abfrage',
+        //typeAhead: true,
+        //mode: 'local',
+        //triggerAction: 'all',
+        //selectOnFocus:true,
+
+    initComponent: function() {
+        this.callParent(arguments);
+    }
+});
+//Ext.define('Lada.view.search.List' ,{
+//    extend: 'Ext.grid.Panel',
+//    alias: 'widget.queryselector',
+//    store: 'Sql',
+//
+//    initComponent: function() {
+//        this.columns = [
+//            {header: 'ID',  dataIndex: 'id',  flex: 1},
+//            {header: 'Kurzname', dataIndex: 'name', flex: 1},
+//            {header: 'SQL', dataIndex: 'desc', flex: 1}
+//        ];
+//
+//        this.callParent(arguments);
+//    }
+//});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/search/Variables.js	Thu May 16 17:55:53 2013 +0200
@@ -0,0 +1,23 @@
+Ext.define('Lada.view.search.Variables' ,{
+    extend: 'Ext.panel.Panel',
+    alias: 'widget.variables',
+    border: false,
+
+    initComponent: function() {
+        this.items = [
+            {
+                id: 'sqlVar1',
+                xtype: 'displayfield',
+                fieldLabel: 'Variables for SQL 1',
+                labelWidth: 300
+            },
+            {
+                id: 'sqlVar2',
+                xtype: 'displayfield',
+                fieldLabel: 'Variables for SQL 2',
+                labelWidth: 300
+            }
+        ];
+        this.callParent(arguments);
+    }
+});
--- a/app/view/sql/List.js	Fri May 10 12:24:45 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-Ext.define('Lada.view.sql.List' ,{
-    extend: 'Ext.grid.Panel',
-    alias: 'widget.sqllist',
-    store: 'Sql',
-
-    initComponent: function() {
-        this.columns = [
-            {header: 'ID',  dataIndex: 'id',  flex: 1},
-            {header: 'Kurzname', dataIndex: 'name', flex: 1},
-            {header: 'SQL', dataIndex: 'desc', flex: 1}
-        ];
-
-        this.callParent(arguments);
-    }
-});
--- a/app/view/sql/Variables.js	Fri May 10 12:24:45 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-Ext.define('Lada.view.sql.Variables' ,{
-    extend: 'Ext.panel.Panel',
-    alias: 'widget.variables',
-    border: false,
-
-    initComponent: function() {
-        this.items = [
-            {
-                id: 'sqlVar1',
-                xtype: 'displayfield',
-                fieldLabel: 'Variables for SQL 1',
-                labelWidth: 300
-            },
-            {
-                id: 'sqlVar2',
-                xtype: 'displayfield',
-                fieldLabel: 'Variables for SQL 2',
-                labelWidth: 300
-            }
-        ];
-        this.callParent(arguments);
-    }
-});

http://lada.wald.intevation.org