Bläddra i källkod

gh-3253 ECL Playground Initial Selection Blank

Initial load should display the default ECL.

fixes gh-3253

Signed-off-by: Gordon Smith <gordon.smith@lexisnexis.com>
Gordon Smith 12 år sedan
förälder
incheckning
0f047ff2d2
1 ändrade filer med 9 tillägg och 14 borttagningar
  1. 9 14
      esp/files/scripts/SampleSelectWidget.js

+ 9 - 14
esp/files/scripts/SampleSelectWidget.js

@@ -52,16 +52,17 @@ require([
 
 
         //  Implementation  ---
         //  Implementation  ---
         _initControls: function () {
         _initControls: function () {
-            var first = true;
-            var context = this;
             this.selectControl = registry.byId(this.id + "SampleSelect");
             this.selectControl = registry.byId(this.id + "SampleSelect");
             this.selectControl.maxHeight = 480;
             this.selectControl.maxHeight = 480;
+        },
+
+        load: function () {
+            var sampleStore = new dojo.data.ItemFileReadStore({
+                url: "ecl/ECLPlaygroundSamples.json"
+            });
+            this.selectControl.setStore(sampleStore);
+            var context = this;
             this.selectControl.onChange = function () {
             this.selectControl.onChange = function () {
-                if (first) {
-                    first = false;
-                    context.selectControl.set("value", "default.ecl");
-                    return;
-                }
                 var filename = this.getValue();
                 var filename = this.getValue();
                 xhr.get({
                 xhr.get({
                     url: "ecl/" + filename,
                     url: "ecl/" + filename,
@@ -73,13 +74,7 @@ require([
                     }
                     }
                 });
                 });
             };
             };
-        },
-
-        load: function () {
-            var sampleStore = new dojo.data.ItemFileReadStore({
-                url: "ecl/ECLPlaygroundSamples.json"
-            });
-            this.selectControl.setStore(sampleStore);
+            this.selectControl.set("value", "default.ecl");
         },
         },
 
 
         onNewSelection: function (eclText) {
         onNewSelection: function (eclText) {