partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 9b1a6acaf379269ae0363db4ff0f3e57bff0b52c
parent 5d1ab58887cafffbab5c639bd7293671be601a75
Author: Felicitus <felicitus@felicitus.org>
Date:   Thu, 27 Aug 2015 18:02:30 +0200

Auto-select value when reloading storage location combobox

Diffstat:
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/ReloadableComboBox.js | 11+++++++----
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/StorageLocationComboBox.js | 4++--
2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/ReloadableComboBox.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/ReloadableComboBox.js @@ -9,13 +9,16 @@ Ext.define("PartKeepr.ReloadableComboBox",{ forceSelection: true, editable: true, initComponent: function () { - this.listenersStore = this.store.mon({ - item: this, + this.listenersStore = this.store.on({ scope: this, // Workaround to remember the value when loading - beforeload: function () { this._oldValue = this.getValue(); }, + beforeload: function () { + this._oldValue = this.getSelection(); + }, // Set the old value when load is complete - load: function () { this.setValue(this._oldValue); } + load: function () { + this.setSelection(this._oldValue); + } }); this.callParent(); diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/StorageLocationComboBox.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/StorageLocationComboBox.js @@ -1,8 +1,8 @@ Ext.define("PartKeepr.StorageLocationComboBox",{ - extend:"Ext.form.field.ComboBox", + extend:"PartKeepr.ReloadableComboBox", alias: 'widget.StorageLocationComboBox', displayField: 'name', - valueField: 'id', + valueField: '@id', queryMode: 'local', triggerAction: 'all',