5 * [Roo.grid.grid] << convert a cfg into a table.
6 * [Roo.grid.grid-edit] << create a config from a tree.
9 * My initial idea was to parse the existing nodes, to generate the cfg.
10 * -- this is far too complicated..
11 * -- let's go back to the idea of storing the config on the relivant nodes.
12 * -- The downside is that if you modify the children, then the wizard will
13 * not know about those columns. etc..
20 Pman.Builder.Wizard = {
27 'time' : 'string', //bogus
34 'timestamp' : 'number',
43 'longtext' : 'string',
44 'tinytext' : 'string',
45 'mediumtext' : 'string',
52 * @param {Object} cfg the configuration
53 * @param {Object} old the previous def...
55 * - cols_ex : [ name, name]
63 - gen config - prior to editing
67 'Roo.GridPanel' : function(cfg, old)
72 var gi = _t['Roo.grid.Grid'](cfg);
78 '.buildercfg' : Roo.encode(cfg),
86 "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}"
93 'Roo.grid.Grid' : function(cfg, old)
102 Roo.each(cfg.cols, function(cc) {
103 colmodel.push( _t['Roo.grid.ColumnModel'](cc) );
106 var dataSource = _t['Roo.data.Store'](cfg);
107 dataSource['*prop'] = 'dataSource';
112 "autoExpandColumn": cfg.cols_ex[0],
115 "|render": "function() \n" +
117 " _this.grid = this; \n" +
118 " //_this.dialog = Pman.Dialog.FILL_IN\n" +
119 " if (_this.panel.active) {\n" +
120 " this.footer.onClick('first');\n" +
123 "|rowdblclick": "function (_self, rowIndex, e)\n" +
125 " if (!_this.dialog) return;\n" +
126 " _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n" +
127 " _this.grid.footer.onClick('first');\n" +
137 "xtype": "PagingToolbar",
140 "displayMsg": "Displaying " + cfg.table + "{0} - {1} of {2}",
141 "emptyMsg": "No " + cfg.table + " found",
152 "cls": "x-btn-text-icon",
153 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
155 "|click": "function()\n"+
157 " if (!_this.dialog) return;\n" +
158 " _this.dialog.show( { id : 0 } , function() {\n"+
159 " _this.grid.footer.onClick('first');\n"+
163 "|xns": "Roo.Toolbar"
168 "cls": "x-btn-text-icon",
169 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
171 "|click": "function()\n"+
173 " var s = _this.grid.getSelectionModel().getSelections();\n"+
174 " if (!s.length || (s.length > 1)) {\n"+
175 " Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n"+
178 " if (!_this.dialog) return;\n" +
179 " _this.dialog.show(s[0].data, function() {\n"+
180 " _this.grid.footer.onClick('first');\n"+
186 "|xns": "Roo.Toolbar"
190 "cls": "x-btn-text-icon",
191 "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
194 "|click": "function()\n"+
196 " Pman.genericDelete(_this, '" + cfg.table + "'); \n"+
200 "|xns": "Roo.Toolbar"
209 'Roo.data.Store' : function(cfg, old, parse_only)
215 _t['Roo.data.Reader'](cfg, old, true);
223 var jreader = _t['Roo.data.Reader'](cfg);
229 '|sortInfo' : "{ field : '" + cfg.cols_ex[0] + "', direction: 'ASC' }",
233 "xtype": "HttpProxy",
235 "|url": "baseURL + '/Roo/" +cfg.table + ".php'",
245 'Roo.data.Reader' : function(cfg)
247 // simple version to start with..
265 Roo.each(cfg.cols, function(cc) {
266 var ty = typeof(_t.typemap[cc.ctype]) == 'undefined' ? 'string' : _t.typemap[cc.ctype];
267 if (cc.ctype == 'string' ) {
268 fields.push(cc.column);
271 fields.push({ name : cc.column, type : _t.typemap[cc.ctype]} );
278 xtype : "JsonReader",
279 totalProperty : "total",
282 id : 'id', // maybe no..
284 '|fields' : JSON.stringify(fields, null,4).replace(/"/g,"'")