changeset 738:2db5d54a5685

Fixed ToDo in Umweltbereiche Store, made Umweltbereiche Typable to fix the regression, Sorted Umweltbereiche by ID
author Dustin Demuth <dustin@intevation.de>
date Mon, 20 Apr 2015 12:24:54 +0200
parents 4031b9aa8d83
children efb1369a8cac
files app/store/Umwelt.js app/view/form/Probe.js app/view/widget/Umwelt.js app/view/widget/base/ComboBox.js
diffstat 4 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/app/store/Umwelt.js	Mon Apr 20 11:15:25 2015 +0200
+++ b/app/store/Umwelt.js	Mon Apr 20 12:24:54 2015 +0200
@@ -13,7 +13,11 @@
     extend: 'Ext.data.Store',
     model: 'Lada.model.Umwelt',
     sorters: [{
+        property: 'id',
+        direction: 'ASC'
+    }, {
         property: 'umweltBereich',
+        direction: 'ASC',
         transform: function(val) {
             if (val) {
                 return val.toLowerCase();
@@ -21,5 +25,7 @@
             return '';
         }
     }],
-    autoLoad: true
+    sortOnLoad: true,
+    remoteSort: false,
+    autoLoad: true,
 });
--- a/app/view/form/Probe.js	Mon Apr 20 11:15:25 2015 +0200
+++ b/app/view/form/Probe.js	Mon Apr 20 12:24:54 2015 +0200
@@ -199,6 +199,7 @@
                             fieldLabel: 'Umweltbereich',
                             labelWidth: 125,
                             allowBlank: false,
+                            editable: true,
                             listeners: {
                                 dirtychange: {
                                     fn: this.updateOnChange,
--- a/app/view/widget/Umwelt.js	Mon Apr 20 11:15:25 2015 +0200
+++ b/app/view/widget/Umwelt.js	Mon Apr 20 12:24:54 2015 +0200
@@ -16,6 +16,7 @@
     displayField: 'id',
     valueField: 'id',
     editable: this.editable || false,
+    forceSelection: true,
     emptyText: 'Wählen Sie einen Umweltbereich',
     // Enable filtering of comboboxes
     autoSelect: false,
@@ -23,28 +24,18 @@
     triggerAction: 'all',
     typeAhead: false,
     minChars: 0,
-    tpl: '<tpl for="."><div class="x-combo-list-item  x-boundlist-item" >' +
-        '{id} - {umweltBereich}</div></tpl>',
-    // TODO: Set value in disply after selection. Can not figure out why
-    // accessing the recored.data attribute fails here (ti) <2013-08-06 16:52>
-    // listeners: {
-    //     select: function(combo, record, index) {
-    //         console.log("1");
-    //         console.log(record);
-    //         console.log("2");
-    //         var text = record.data['umwId'] +
-    //             " - " + record.data['umweltBereich'];
-    //         console.log("3");
-    //         Ext.form.ComboBox.superclass.setValue.call(this, text);
-    //         combo.value = record.id;
-    //     }
-    // },
+    tpl: Ext.create("Ext.XTemplate",
+        '<tpl for="."><div class="x-combo-list-item  x-boundlist-item" >' +
+            '{id} - {umweltBereich}</div></tpl>'),
+    displayTpl: Ext.create('Ext.XTemplate',
+         '<tpl for=".">{id} - {umweltBereich}</tpl>'),
 
     initComponent: function() {
         this.store = Ext.data.StoreManager.get('umwelt');
         if (!this.store) {
             this.store = Ext.create('Lada.store.Umwelt');
         }
+        this.store.sort();
         this.callParent(arguments);
     }
 });
--- a/app/view/widget/base/ComboBox.js	Mon Apr 20 11:15:25 2015 +0200
+++ b/app/view/widget/base/ComboBox.js	Mon Apr 20 12:24:54 2015 +0200
@@ -36,8 +36,10 @@
             minChars: this.minChars,
             multiSelect: this.multiSelect,
             editable: this.editable || false,
+            forceSelection: this.forceSelection,
             msgTarget: 'none',
-            tpl: this.tpl
+            tpl: this.tpl,
+            displayTpl: this.displayTpl
         }, {
             xtype: 'image',
             name: 'warnImg',

http://lada.wald.intevation.org