resources/Editors/Editor.Roo.LayoutDialog.bjs
[app.Builder.js] / resources / Editors / Editor.Roo.LayoutDialog.js
index 2ac4c07..bac84b6 100644 (file)
@@ -379,27 +379,22 @@ Editor.Roo.LayoutDialog = new Roo.XComponent({
          store : {
           '|xns' : 'Roo.data',
           data : [ 
-              [ 'ComboBox', "ComboBox"],
-              [ 'Text' , "TextField"],
-              [ 'Number', "NumberField"],
-              [ 'TextArea', "TextArea"],
-              [ 'Html', "HtmlEntry"]
-              
+              ['id']
           ],
-          fields : [  'ftype', 'fname'],
+          fields : [  'dfield'],
           xns : Roo.data,
           xtype : 'SimpleStore'
          },
          '|xns' : 'Roo.form',
          allowBlank : false,
-         displayField : 'fname',
+         displayField : 'dfield',
          editable : false,
          hiddenName : 'status',
          listWidth : 200,
          mode : 'local',
          name : 'display_field',
          triggerAction : 'all',
-         valueField : 'ftype',
+         valueField : 'dfield',
          width : 150,
          xns : Roo.form,
          xtype : 'ComboBox',
@@ -458,6 +453,17 @@ Editor.Roo.LayoutDialog = new Roo.XComponent({
       }
     ],
     listeners : {
+     beforeedit : function (e)
+      {
+          Roo.log('before edit!!!');
+          Roo.log(e);
+          
+          if(e.field != 'display_field'){
+              return;
+          }
+          
+          _this.grid.colModel.getCellEditor(e.column, e.row).field.store.loadData(e.record.data.relates_to_schema);
+      },
      cellclick : function (_self, rowIndex, columnIndex, e)
       {
       
@@ -528,7 +534,7 @@ Editor.Roo.LayoutDialog = new Roo.XComponent({
                title : r.Field,
                width : 100,
                ftype : 'TextField',
-               display_field : r.Field + '_display_name',
+               display_field : rc, //r.Field + '_display_name',
                relates_to_table : rt,
                relates_to_col : rc,
                relates_to_schema : rs
@@ -568,7 +574,7 @@ Editor.Roo.LayoutDialog = new Roo.XComponent({
                var f = fields.items[j];
                
                if(dd.hasOwnProperty(f.name)){
-                   a.push(o[f.name]);
+                   a.push(dd[f.name]);
                }
            }
            
@@ -605,7 +611,7 @@ Editor.Roo.LayoutDialog = new Roo.XComponent({
            var el = {
                fieldLabel : rec.data.title,
                name : rec.data.dataIndex,
-               width : 200, //row.type == 'string' ? 200 : 75,
+               width : r.data.width,
                '|xns' : 'Roo.form',
                xtype : rec.data.ftype
            }
@@ -626,12 +632,15 @@ Editor.Roo.LayoutDialog = new Roo.XComponent({
            if (xtype == 'Combobox') {
            
    
-               el.queryParam  = 'query[' + combofields_name + ']';// SET WHEN USED
+               el.queryParam  = 'query[' + rec.data.display_field + ']';// SET WHEN USED
                
                el.hiddenName = rec.data.dataIndex // SET WHEN USED eg. project_id
-               el.displayField = combofields_name; // SET WHEN USED eg. project_id
-               el.name  = old.name + '_' + combofields_name; // SET WHEN USED eg. project_id_name
-               el.tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + combofields_name +'}</b> </div>'; // SET WHEN USED
+               el.name  = rec.data.dataIndex + '_' + rec.data.display_field; // SET WHEN USED eg. project_id_name
+               
+               el.displayField = rec.data.display_field // SET WHEN USED eg. project_id
+               el.valueField = rec.data.relates_to_col 
+               
+               el.tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + rec.data.display_field +'}</b> </div>'; // SET WHEN USED
              
            
               el.items = [
@@ -655,7 +664,7 @@ Editor.Roo.LayoutDialog = new Roo.XComponent({
                                'xtype' : 'HttpProxy',
                                'method' : 'GET',
                                '|xns' : 'Roo.data',
-                               '|url' : "baseURL + '/Roo/" + reftable + ".php'",
+                               '|url' : "baseURL + '/Roo/" + rec.data.relates_to_table + ".php'",
                            },
                            
                            {
@@ -674,6 +683,26 @@ Editor.Roo.LayoutDialog = new Roo.XComponent({
            
            }
            
+           if (xtype == 'HtmlEditor') {
+               el.height = 100,
+               el.resizable = 's',
+               el.toolbar = [
+                   {
+                       '|xns' : 'Roo.form.HtmlEditor',
+                       'xtype' : 'ToolbarContext'
+                   },
+                   {
+                       '|xns' : 'Roo.form.HtmlEditor',
+                       'xtype' : 'ToolbarStandard'
+   
+                  }
+               ]
+           }
+           
+           if(xtype == 'Checkbox'){
+               el.inputValue = 1,
+               el.valueOff = 0
+           }
            
            formElements.push(el);