Preview.php
[Pman.Builder] / Pman.Dialog.BuilderAddTable.js
index 78d6c6b..eec49a3 100644 (file)
@@ -87,6 +87,7 @@ Pman.Dialog.BuilderAddTable = {
                             }
                         },
                         autoExpandColumn : 'desc',
+                        clicksToEdit : 1,
                         loadMask : true,
                         dataSource : {
                             xtype: 'Store',
@@ -115,10 +116,22 @@ Pman.Dialog.BuilderAddTable = {
                                     });
                                     Roo.each(records, function (col) {
                                         col.set('use_ex', _this.data.cols_ex.indexOf(col.data.column) > -1 ? 1 : 0);
-                                        if (typeof(cmap[col.data.column]) == 'undefined') {
-                                            return;
+                                
+                                        if (typeof(cmap[col.data.column]) != 'undefined') {
+                                
+                                            col.set('title',  typeof(cmap[col.data.column].title) == 'undefined' ? '' : cmap[col.data.column].title);
+                                            col.set('use', 1);
                                         }
-                                        col.set('use', 1);
+                                        if (!col.data.title.length) {
+                                        
+                                            if (col.data.columnshort.substring(0, col.data.table.length) == col.data.table) {
+                                                // it's prefixed with table name..
+                                                col.set('title', col.data.columnshort.substring(col.data.table.length+1));
+                                            } else {
+                                                col.set('title', col.data.columnshort);
+                                            }
+                                        } 
+                                       
                                 
                                         // what about descption..
                                     });
@@ -144,7 +157,7 @@ Pman.Dialog.BuilderAddTable = {
                                 fields : [
                                     { name: 'use', type: 'int'} , 
                                     { name: 'use_ex', type: 'int'}, 
-                                    'table', 'column', 'ctype', 'desc', 'columnshort'
+                                    'table', 'column', 'ctype', 'desc', 'columnshort', 'title'
                                 ]
                             }
                         },
@@ -217,7 +230,7 @@ Pman.Dialog.BuilderAddTable = {
                                     
                                         return String.format('<B>{0}</B>', v); 
                                     }
-                                    return String.format('{0}.{0}', r.data.table, r.data.columnshort); 
+                                    return String.format('{0}...{1}', r.data.table, r.data.columnshort); 
                                 }
                             },
                             {
@@ -227,11 +240,11 @@ Pman.Dialog.BuilderAddTable = {
                                 header : 'Title',
                                 width : 150,
                                 renderer : function(v,x,r) { 
-                                    if (r.data.table == _this.data.table) {
+                                     
+                                    var u = r.data.use * 1;
+                                     u += (r.data.use_ex*1);
                                     
-                                        return String.format('<B>{0}</B>', v); 
-                                    }
-                                    return String.format('.....{0}', r.data.columnshort); 
+                                    return String.format('{0}', u ? v : ''); 
                                 },
                                 editor : {
                                     xtype: 'GridEditor',
@@ -292,7 +305,11 @@ Pman.Dialog.BuilderAddTable = {
                              _this.grid.ds.each(function(r) {
                              
                                 if (r.data.use*1) {
-                                        ret.cols.push(r.json);
+                                
+                                    var d = Roo.apply({}, r.json);
+                                    Roo.apply(d, r.data);
+                                    ret.cols.push(d);
+                                        
                                 }
                                  if (r.data.use_ex*1) {
                                      ret.cols_ex.push( r.data.column );
@@ -305,8 +322,10 @@ Pman.Dialog.BuilderAddTable = {
                                 return;
                             }
                              Roo.log(ret);
+                        
+                            _this.dialog.hide();
                              _this.callback(ret);
-                             _this.dialog.hide();
+                             
                         
                         }
                     },