examples/form/dynamic.js
[roojs1] / examples / form / dynamic.js
index a8b37ce..bdeecdd 100644 (file)
@@ -10,7 +10,8 @@
  */
  
 var mform;
-var simple\r
+var simple;
+\r
 Roo.onReady(function(){
 
     Roo.QuickTips.init();
@@ -80,18 +81,121 @@ Roo.onReady(function(){
                         xtype : 'ComboBoxArray',
                         xns : Roo.form,
                         fieldLabel: 'Multi select test',
-                        name: 'country',
-                        hiddenName: 'countryNames',
-                        width: 500,
+                        name: 'countryNames',
+                        hiddenName: 'country',
                         
+                        width: 550,
+                        combo : {
+                            
+                            valueField : 'abbr',
+                            displayField : 'state',
+                            
+                            name : 'countryNames',
+                            hiddenName : 'country',
+                            
+                            xtype : 'ComboBox',
+                            xns : Roo.form,
+                            store: {
+                                xtype : 'SimpleStore',
+                                xns: Roo.data,
+                                fields: ['abbr', 'state'],
+                                data : Roo.exampledata.states // from states.js    
+                            },
+                            width: 200,
+                            listWidth : 300,
+                            editable : false,
+                            
+                            typeAhead: false,
+                            mode: 'local',
+                            triggerAction: 'all',
+                            emptyText:'Select a state...',
+                            selectOnFocus:true,
+                            resizable:true
+                        }
                         
                         
+                    }
+                    
+                ]
+            },
+            
+            
+            {
+                
+                xtype : 'Column', 
+                width: 500, // precise column sizes or percentages or straight CSS
+                items : [
+                    {
+                        xtype : 'ComboBoxArray',
+                        xns : Roo.form,
+                        fieldLabel: 'Multi select test',
+                        name: 'countryNames2',
+                        hiddenName: 'country2',
+                        
+                        width: 550,
+                        combo : {
+                            
+                            valueField : 'abbr',
+                            displayField : 'state',
+                            
+                            // thes are not really needed as parent overwrites them!?
+                            name : 'countryNames',
+                            hiddenName : 'country',
+                            
+                            xtype : 'ComboBox',
+                            xns : Roo.form,
+                            
+                            
+                             
+        
+                            
+                            store: {
+                                xtype : 'Store',
+                                xns: Roo.data,
+                                
+                                proxy: {
+                                    xns : Roo.data,
+                                    xtype : 'ScriptTagProxy',
+                                    url: 'http://www.roojs.com/forum/topics-remote.php'
+                                },
+                                reader: {
+                                    xns : Roo.data,
+                                    xtype : 'JsonReader',
+                                    root: 'topics',
+                                    totalProperty: 'totalCount',
+                                    id: 'post_id',
+                                    fields : [
+                                        {name: 'title', mapping: 'topic_title'},
+                                        {name: 'topicId', mapping: 'topic_id'},
+                                        {name: 'author', mapping: 'author'},
+                                        {name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'timestamp'},
+                                        {name: 'excerpt', mapping: 'post_text'}
+                                    ]
+                                }
+                            },
+                            width: 200,
+                            listWidth : 300,
+                            editable : false,
+                            
+                            typeAhead: false,
+                            mode: 'local',
+                            triggerAction: 'all',
+                            emptyText:'Select a state...',
+                            selectOnFocus:true,
+                            resizable:true
+                        }
+                        
                         
                     }
                     
                 ]
             },
             
+           
+
+            
+            
+            
             {
                 
                 xtype : 'Column', 
@@ -158,11 +262,11 @@ Roo.onReady(function(){
    
     mform.render('form-ct2');
     mform.setValues({
-        country  : 'HK,SG',
-        countryNames : 'Hong Kong, Singapore'
-        
-    })
-
+        country  : 'AK,LA',
+        countryNames : 'Alaska,Louisana',
+        country2  : 'AK,LA',
+        countryNames2 : 'Alaska,Louisana'        
+    });
     /*
      * ================  Form 3  =======================
      */