From ae1f9536faee7eaf3f7a1e10324fcb6df59651ac Mon Sep 17 00:00:00 2001 From: uprel Date: Thu, 14 Feb 2019 09:46:00 +0100 Subject: [PATCH] Rework map projection list on startup to prepare store first and load data in webgisinit --- client/site/js/GUI.js | 24 +++++++++++++++++++----- client/site/js/WebgisInit.js | 4 ++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/client/site/js/GUI.js b/client/site/js/GUI.js index 00fb662d..5bd3705d 100644 --- a/client/site/js/GUI.js +++ b/client/site/js/GUI.js @@ -351,19 +351,33 @@ MyViewportUi = Ext.extend(Ext.Viewport, { }, { xtype: 'tbfill' }, { - xtype: 'combo', - id: 'rightStatusText', + xtype: 'combo', + id: 'rightStatusText', + valueField: 'code', + displayField: 'description', hideLabel: true, editable: false, mode: 'local', triggerAction: 'all', width: 160, - store: projectData.crsComboStore(), - value: projectData.crsComboStore()[0][1], + store: { + xtype: 'arraystore', + // store configs + autoDestroy: true, + storeId: 'crsStore', + // reader configs + idIndex: 0, + fields: [{ + name: 'code', mapping: 0 + }, { + name: 'description', mapping: 1 + }] + }, + //value: projectData.crsComboStore()[0][1], listeners: { "select": function(combo, record, index) { Eqwc.currentMapProjection = projectData.getProjectionsList().filter(function (val) { - return val[0] === record.data.field1; + return val[0] === record.data.code; })[0]; } //"render": function(c) { diff --git a/client/site/js/WebgisInit.js b/client/site/js/WebgisInit.js index 9e02f663..e8d1181c 100755 --- a/client/site/js/WebgisInit.js +++ b/client/site/js/WebgisInit.js @@ -108,6 +108,10 @@ Ext.onReady(function () { mainStatusText = Ext.getCmp('mainStatusText'); rightStatusText = Ext.getCmp('rightStatusText'); + //set crs values + rightStatusText.store.loadData(projectData.crsComboStore()); + rightStatusText.setValue(projectData.crsComboStore()[0][1]); + //set some status messsages mainStatusText.setText(mapAppLoadingString[lang]);