torsten@6: Ext.define('Lada.controller.Sql', { torsten@6: extend: 'Ext.app.Controller', torsten@6: views: [ torsten@28: 'search.List' torsten@6: ], torsten@8: stores: [ torsten@8: 'Sql' torsten@8: ], torsten@6: init: function() { torsten@6: console.log('Initialising the Sql controller'); torsten@6: this.control({ torsten@6: // CSS like selector to select element in the viewport. See torsten@6: // ComponentQuery documentation for more details. torsten@28: 'queryselector': { torsten@6: // Map the "render" event to the given function. torsten@6: render: this.onPanelRendered, torsten@6: // Map Doubleclick on rows of the probenlist. torsten@28: select: this.selectSql torsten@6: } torsten@6: }); torsten@6: }, torsten@6: onPanelRendered: function() { torsten@6: console.log('The panel was rendered'); torsten@6: }, torsten@28: selectSql: function(element, record, index) { torsten@28: //var selection = record.get('id'); torsten@28: var selection = index; torsten@25: var variables = Ext.getCmp('variables'); torsten@25: var result = Ext.getCmp('result'); torsten@25: console.log('Selected SQL ' + selection); torsten@25: //// Set correct form for the current SQL-Selection torsten@25: //console.log('Length is ' + variables.items.length); torsten@25: //if (variables.items.length > 1) { torsten@25: // console.log('Length is > than 1'); torsten@25: // variables.remove(currentVar.id); torsten@25: //} torsten@25: //if (selection == 1) { torsten@25: // currentVar = variables1; torsten@25: //} torsten@25: //else { torsten@25: // currentVar = variables2; torsten@25: //} torsten@25: //variables.add(currentVar); torsten@25: //// Show the panel for the variable definiton. torsten@25: //variables.show(); torsten@17: torsten@17: // Show the results. torsten@28: console.log('Loading store'); torsten@25: result.getStore().load(); torsten@28: console.log('Store loaded'); torsten@25: result.show(); torsten@6: } torsten@6: }); torsten@17: torsten@17: torsten@17: var currentVar = null; torsten@17: var variables1 = { torsten@17: xtype: 'panel', torsten@17: id: 'variable1', torsten@17: border: false, torsten@17: html: 'Variablen für Abfrage 1' torsten@17: }; torsten@17: torsten@17: var variables2 = { torsten@17: xtype: 'panel', torsten@17: id: 'variable2', torsten@17: border: false, torsten@17: html: 'Variablen für Abfrage 2' torsten@17: };