allow string based values for comboboxarray
[roojs1] / Roo / form / GridField.js
index 2c391d6..4f964a7 100644 (file)
@@ -4,6 +4,14 @@
  * @extends Roo.form.Field
  * Embed a grid (or editable grid into a form)
  * STATUS ALPHA
+ * 
+ * This embeds a grid in a form, the value of the field should be the json encoded array of rows
+ * it needs 
+ * xgrid.store = Roo.data.Store
+ * xgrid.store.proxy = Roo.data.MemoryProxy (data = [] )
+ * xgrid.store.reader = Roo.data.JsonReader 
+ * 
+ * 
  * @constructor
  * Creates a new GridField
  * @param {Object} config Configuration options
@@ -33,7 +41,7 @@ Roo.extend(Roo.form.GridField, Roo.form.Field,  {
      * {tag: "input", type: "checkbox", autocomplete: "off"})
      */
    // defaultAutoCreate : { tag: 'div' },
-    defaultAutoCreate : { tag: 'input', type: 'hidden', autocomplete: 'off'},
+    defaultAutoCreate : { tag: 'input', type: 'hidden', autocomplete: 'new-password'},
     /**
      * @cfg {String} addTitle Text to include for adding a title.
      */
@@ -65,7 +73,7 @@ Roo.extend(Roo.form.GridField, Roo.form.Field,  {
         var style = this.style;
         delete this.style;
         
-        Roo.form.DisplayImage.superclass.onRender.call(this, ct, position);
+        Roo.form.GridField.superclass.onRender.call(this, ct, position);
         this.wrap = this.el.wrap({cls: ''}); // not sure why ive done thsi...
         this.viewEl = this.wrap.createChild({ tag: 'div' });
         if (style) {
@@ -107,6 +115,11 @@ Roo.extend(Roo.form.GridField, Roo.form.Field,  {
             data[ds.reader.meta.root ] =  typeof(v) == 'string' ? Roo.decode(v) : v;
             ds.loadData( data);
         }
+        // clear selection so it does not get stale.
+        if (this.grid.sm) { 
+            this.grid.sm.clearSelections();
+        }
+        
         Roo.form.GridField.superclass.setValue.call(this, v);
         this.refreshValue();
         // should load data in the grid really....