1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Dialog.BuilderAddTable = {
10 show : function(data, cb)
18 this.dialog.show(this.data._el);
21 this.form.setValues(data);
22 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
30 this.dialog = Roo.factory({
31 xtype: 'LayoutDialog',
34 show : function (_self)
36 _this.grid.ds.load({});
44 title : "Select columns to use",
51 activate : function() {
54 _this.grid.ds.load({});
71 //_this.dialog = Pman.Dialog.FILL_IN
72 if (_this.panel.active) {
76 cellclick : function (_self, ri, ci , e)
78 if (ci > 1) {return; }
80 var rec = this.ds.getAt(ri);
81 var di = this.cm.getDataIndex(ci);
82 rec.set(di, (rec.data[di] * 1) ? 0 : 1);
89 autoExpandColumn : 'desc',
96 beforeload : function (_self, options)
98 if (typeof(_this.data) == 'undefined') {
102 options.params = options.params || {};
103 options.params.table = _this.data.table;
105 load : function (_self, records, options)
107 // after load, if we have configuration already, overlay that
108 if (typeof(_this.data.cols) == 'undefined') {
111 _this.data.cols_ex = _this.data.cols_ex || [];
113 Roo.each(_this.data.cols, function (col) {
114 cmap[col.column] = col;
117 Roo.each(records, function (col) {
118 col.set('use_ex', _this.data.cols_ex.indexOf(col.data.column) > -1 ? 1 : 0);
120 if (typeof(cmap[col.data.column]) != 'undefined') {
122 col.set('title', typeof(cmap[col.data.column].title) == 'undefined' ? '' : cmap[col.data.column].title);
125 if (!col.data.title.length) {
127 if (col.data.columnshort.substring(0, col.data.table.length) == col.data.table) {
128 // it's prefixed with table name..
129 col.set('title', col.data.columnshort.substring(col.data.table.length+1));
131 col.set('title', col.data.columnshort);
136 // what about descption..
144 sortInfo : { field : 'filename', direction: 'ASC' },
149 url : baseURL + '/Builder/ERM.php'
156 totalProperty : 'total',
158 { name: 'use', type: 'int'} ,
159 { name: 'use_ex', type: 'int'},
160 'table', 'column', 'ctype', 'desc', 'columnshort', 'title'
177 cls : 'x-btn-text-icon',
179 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
187 // Pman.genericDelete(_this, 'Images');
190 cls : 'x-btn-text-icon',
192 icon : rootURL + '/Pman/templates/images/trash.gif'
198 xtype: 'ColumnModel',
203 renderer : function(v) {
204 var state = v> 0 ? '-checked' : '';
206 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
210 xtype: 'ColumnModel',
212 dataIndex : 'use_ex',
213 header : 'Display/Expand',
215 renderer : function(v) {
216 var state = v> 0 ? '-checked' : '';
218 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
223 xtype: 'ColumnModel',
225 dataIndex : 'column',
228 renderer : function(v,x,r) {
229 if (r.data.table == _this.data.table) {
231 return String.format('<B>{0}</B>', v);
233 return String.format('{0}...{1}', r.data.table, r.data.columnshort);
237 xtype: 'ColumnModel',
242 renderer : function(v,x,r) {
244 var u = r.data.use * 1;
245 u += (r.data.use_ex*1);
247 return String.format('{0}', u ? v : '');
259 xtype: 'ColumnModel',
264 renderer : function(v) {
270 xtype: 'ColumnModel',
273 header : 'Description',
275 renderer : function(v) { return String.format('{0}', v); }
282 xtype: 'LayoutRegion',
290 click : function (_self, e)
301 click : function (_self, e)
303 var ret = Roo.applyIf({ cols : [], cols_ex: [] }, _this.data);
305 _this.grid.ds.each(function(r) {
309 var d = Roo.apply({}, r.json);
310 Roo.apply(d, r.data);
314 if (r.data.use_ex*1) {
315 ret.cols_ex.push( r.data.column );
320 if (!ret.cols_ex.length) {
321 Roo.MessageBox.alert("Error", "Select at least one Display/expand col");