[Lada-commits] [PATCH] Fixed ToDo in Umweltbereiche Store, made Umweltbereiche Typable to fix the regression, Sorted Umweltbereiche by ID

Wald Commits scm-commit at wald.intevation.org
Mon Apr 20 12:25:12 CEST 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1429525494 -7200
# Node ID 2db5d54a5685dab5400b1e049862192702442cb2
# Parent  4031b9aa8d8336b0f562a8cac8e5d11fb51e97d3
Fixed ToDo in Umweltbereiche Store, made Umweltbereiche Typable to fix the regression, Sorted Umweltbereiche by ID

diff -r 4031b9aa8d83 -r 2db5d54a5685 app/store/Umwelt.js
--- 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,
 });
diff -r 4031b9aa8d83 -r 2db5d54a5685 app/view/form/Probe.js
--- 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,
diff -r 4031b9aa8d83 -r 2db5d54a5685 app/view/widget/Umwelt.js
--- 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);
     }
 });
diff -r 4031b9aa8d83 -r 2db5d54a5685 app/view/widget/base/ComboBox.js
--- 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',


More information about the Lada-commits mailing list