diff app/view/widgets/Messmethode.js @ 490:446e99cfd425

Updated views and controllers using the new model and stores.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 31 Oct 2014 21:28:31 +0100
parents e45f4df57938
children 850ccfe5f3c4
line wrap: on
line diff
--- a/app/view/widgets/Messmethode.js	Fri Oct 31 21:11:25 2014 +0100
+++ b/app/view/widgets/Messmethode.js	Fri Oct 31 21:28:31 2014 +0100
@@ -6,42 +6,29 @@
  * the documentation coming with IMIS-Labordaten-Application for details. 
  */
 
-var mmtStore = Ext.create('Ext.data.Store', {
-    fields: ['mmtId', 'messmethode'],
-    sorters: [{
-        property: 'mmtId'
-    }],
-    autoLoad: true,
-    proxy: {
-        type: 'ajax',
-        api: {
-        read: 'server/rest/messmethode'
-        },
-        reader: {
-            type: 'json',
-            root: 'data'
-        }
-    }
-});
-
 /**
  * Combobox for Messmethode
  */
 Ext.define('Lada.view.widgets.Messmethode' ,{
-        tpl: '<tpl for="."><div class="x-combo-list-item x-boundlist-item" >{mmtId} - {messmethode}</div></tpl>',
-        extend: 'Ext.form.ComboBox',
-        alias: 'widget.messmethode',
-        store: mmtStore,
-        displayField:'messmethode',
-        valueField: 'mmtId',
-        emptyText:'Wählen Sie eine Messmethode',
-        // Enable filtering of comboboxes
-        autoSelect: false,
-        queryMode: 'local',
-        triggerAction : 'all',
-        typeAhead: false,
-        minChars: 0,
+    extend: 'Ext.form.ComboBox',
+    require: ['Lada.store.StaMessmethoden'],
+    alias: 'widget.messmethode',
+    store: 'StaMessmethoden',
+    displayField:'messmethode',
+    valueField: 'id',
+    emptyText:'Wählen Sie eine Messmethode',
+    // Enable filtering of comboboxes
+    autoSelect: false,
+    queryMode: 'local',
+    triggerAction : 'all',
+    typeAhead: false,
+    minChars: 0,
+    tpl: '<tpl for="."><div class="x-combo-list-item x-boundlist-item" >{id} - {messmethode}</div></tpl>',
     initComponent: function() {
+        this.store = Ext.data.StoreManager.get('StaMessmethoden');
+        if (!this.store) {
+            this.store = Ext.create('Lada.store.StaMessmethoden');
+        }
         this.callParent(arguments);
     }
 });

http://lada.wald.intevation.org