commit 595529d60fc1a4977cb436ffd06370ea14485ba0
parent ca52cc6adaadd8408f219c78f474153a1d210dec
Author: Felicitus <felicitus@felicitus.org>
Date: Wed, 4 Jan 2012 18:27:29 +0100
Refactored storage locations from time-triggered loading to on-demand loading
Diffstat:
2 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/src/frontend/js/Components/Widgets/StorageLocationComboBox.js b/src/frontend/js/Components/Widgets/StorageLocationComboBox.js
@@ -8,17 +8,13 @@ Ext.define("PartKeepr.StorageLocationComboBox",{
triggerAction: 'all',
initComponent: function () {
- this.store = PartKeepr.getApplication().getStorageLocationStore();
-
- /* Workaround to remember the value when loading */
- this.store.on("beforeload", function () {
- this._oldValue = this.getValue();
- }, this);
-
- /* Set the old value when load is complete */
- this.store.on("load", function () {
- this.setValue(this._oldValue);
- }, this);
+ this.store = Ext.create("Ext.data.Store",
+ {
+ model: 'PartKeepr.StorageLocation',
+ proxy: PartKeepr.getRESTProxy("StorageLocation"),
+ pageSize: -1,
+ autoLoad: true
+ });
this.callParent();
}
diff --git a/src/frontend/js/PartKeepr.js b/src/frontend/js/PartKeepr.js
@@ -139,13 +139,6 @@ Ext.application({
this.setSession(null);
},
createGlobalStores: function () {
- this.storageLocationStore = Ext.create("Ext.data.Store",
- {
- model: 'PartKeepr.StorageLocation',
- pageSize: -1,
- autoLoad: false
- });
-
this.footprintStore = Ext.create("Ext.data.Store",
{
model: 'PartKeepr.Footprint',
@@ -274,9 +267,6 @@ Ext.application({
getPartUnitStore: function () {
return this.partUnitStore;
},
- getStorageLocationStore: function () {
- return this.storageLocationStore;
- },
getFootprintStore: function () {
return this.footprintStore;
},
@@ -327,7 +317,6 @@ Ext.application({
*/
reloadStores: function () {
if (this.getSession()) {
- this.storageLocationStore.load();
this.footprintStore.load();
this.manufacturerStore.load();
this.distributorStore.load();