Use statemanager for toggle states

Change-Id: Iafbdf69140b69ffabd5c26ffab3b2e055d2e3fe3
diff --git a/dev/js/src/state/manager.js b/dev/js/src/state/manager.js
index 4376b27..339503d 100644
--- a/dev/js/src/state/manager.js
+++ b/dev/js/src/state/manager.js
@@ -63,11 +63,6 @@
       const t = this;
       let s = stateClass.create(values);
 
-      // Load state
-      if (t._states[name] !== undefined) {
-        s.set(t._states[name]);
-      };
-
       // Set default value
       // TODO: It would be better to make this part
       // of the state and serialize correctly using TOJSON()
@@ -88,6 +83,11 @@
         }
       });
       
+      // Load state
+      if (t._states[name] !== undefined) {
+        s.set(t._states[name]);
+      };
+
       return s;
     }
   };