Roo/form/ComboBoxArray.js
[roojs1] / Roo / form / Select.js
index 24b08fa..77001b7 100644 (file)
@@ -179,6 +179,12 @@ Roo.extend(Roo.form.Select , Roo.form.ComboBox, {
      * the store, valueNotFoundText will be displayed as the field text if defined (defaults to undefined)
      */
     valueNotFoundText : undefined,
+    
+    /**
+     * @cfg {String} defaultValue The value displayed after loading the store.
+     */
+    defaultValue: '',
+    
     /**
      * @cfg {Boolean} blockFocus Prevents all focus calls, so it can work with things like HTML edtor bar
      */
@@ -292,7 +298,10 @@ Roo.extend(Roo.form.Select , Roo.form.ComboBox, {
                 op.innerHTML = String.format('{0}', r.data[df]);
                 dom.appendChild(op);
             });
-            Roo.log()
+            if (typeof(this.defaultValue != 'undefined')) {
+                this.setValue(this.defaultValue);
+            }
+            
              
         }else{
             //this.onEmptyResults();
@@ -359,10 +368,10 @@ Roo.extend(Roo.form.Select , Roo.form.ComboBox, {
      * @param {String} value The value to match
      */
     setValue : function(v){
-        
-        for (var i =0; i < this.dom.options.length;i++) {
-            if (v == this.dom.options[i].value) {
-                this.dom.selectedIndex = i;
+        var d = this.el.dom;
+        for (var i =0; i < d.options.length;i++) {
+            if (v == d.options[i].value) {
+                d.selectedIndex = i;
                 this.value = v;
                 return;
             }
@@ -602,5 +611,5 @@ Roo.extend(Roo.form.Select , Roo.form.ComboBox, {
     },
     getResizeEl : function(){
         return this.el;
-    },
+    }
 });
\ No newline at end of file