From 08eb75861ca71671789884a632462c1ab5c10c6e Mon Sep 17 00:00:00 2001 From: George Michael Brower Date: Mon, 18 Apr 2011 17:10:05 -0700 Subject: [PATCH] Fixed options method to make sure the initial value is actually selected --- index.html | 13 ++++++++----- src/DAT/GUI/Controller.js | 6 ++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 10bea19..94a8f87 100644 --- a/index.html +++ b/index.html @@ -6,13 +6,15 @@ + type="text/css"/> + - - + + @@ -78,7 +80,8 @@ var element; for (var i = 0; (element = allElements[i]) != null; i++) { var elementClass = element.className; - if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass)) + if (elementClass && elementClass.indexOf(className) != -1 && + hasClassName.test(elementClass)) results.push(element); } diff --git a/src/DAT/GUI/Controller.js b/src/DAT/GUI/Controller.js index 89f1e2f..f802b4f 100644 --- a/src/DAT/GUI/Controller.js +++ b/src/DAT/GUI/Controller.js @@ -76,6 +76,9 @@ DAT.GUI.Controller.prototype.options = function() { var opt = document.createElement('option'); opt.innerHTML = i; opt.setAttribute('value', arr[i]); + if (arguments[i] == this.getValue()) { + opt.selected = true; + } select.appendChild(opt); } } else { @@ -83,6 +86,9 @@ DAT.GUI.Controller.prototype.options = function() { var opt = document.createElement('option'); opt.innerHTML = arguments[i]; opt.setAttribute('value', arguments[i]); + if (arguments[i] == this.getValue()) { + opt.selected = true; + } select.appendChild(opt); } }