Pman.Tab.XtupleMetric.bjs
[Pman.Xtuple] / Pman.Tab.XtupleMetric.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Tab.XtupleMetric = new Roo.XComponent({
6     part     :  ["Xtuple","Metric"],
7     order    : '900-Pman.Tab.XtupleMetric',
8     region   : 'center',
9     parent   : 'Pman.Tab.Admin',
10     name     : "unnamed module",
11     disabled : false, 
12     permname : '', 
13     _tree : function()
14     {
15         var _this = this;
16         var MODULE = this;
17         return {
18             xtype: 'GridPanel',
19             xns: Roo,
20             listeners : {
21                 activate : function() {
22                     _this.panel = this;
23                     if (_this.grid) {
24                         _this.grid.footer.onClick('first');
25                     }
26                 }
27             },
28             background : true,
29             fitContainer : true,
30             fitToframe : true,
31             region : 'center',
32             tableName : 'metric',
33             title : "Metric",
34             grid : {
35                 xtype: 'EditorGrid',
36                 xns: Roo.grid,
37                 listeners : {
38                     render : function() 
39                     {
40                         _this.grid = this; 
41                         if (_this.panel.active) {
42                            this.footer.onClick('first');
43                         }
44                     },
45                     afteredit : function (e)
46                     {
47                         if(e.originalValue == e.value || !e.value.length){
48                             return false;
49                         }
50                         
51                         e.record.commit();
52                     }
53                 },
54                 autoExpandColumn : 'metric_value',
55                 clicksToEdit : 1,
56                 loadMask : true,
57                 dataSource : {
58                     xtype: 'Store',
59                     xns: Roo.data,
60                     listeners : {
61                         beforeload : function (_self, o){
62                             o.params = o.params || {};
63                             
64                             var s = _this.searchBox.getValue();
65                             
66                             if(!s || !s.length){
67                                 return;
68                             }
69                             
70                             o.params['search[name]'] = s;
71                         }
72                     },
73                     remoteSort : true,
74                     sortInfo : { field : 'metric_name', direction: 'ASC' },
75                     proxy : {
76                         xtype: 'HttpProxy',
77                         xns: Roo.data,
78                         method : 'GET',
79                         timeout : 90000,
80                         url : baseURL + '/Xtuple/Roo/Metric.php'
81                     },
82                     reader : {
83                         xtype: 'JsonReader',
84                         xns: Roo.data,
85                         id : 'metric_id',
86                         root : 'data',
87                         totalProperty : 'total',
88                         fields : [
89                             {
90                                 'name': 'metric_id',
91                                 'type': 'int'
92                             },
93                             {
94                                 'name': 'metric_name',
95                                 'type': 'string'
96                             },
97                             {
98                                 'name': 'metric_value',
99                                 'type': 'string'
100                             },
101                             {
102                                 'name': 'metric_module',
103                                 'type': 'string'
104                             }
105                         ]
106                     }
107                 },
108                 toolbar : {
109                     xtype: 'Toolbar',
110                     xns: Roo,
111                     items : [
112                         {
113                             xtype: 'TextField',
114                             xns: Roo.form,
115                             listeners : {
116                                 specialkey : function (_self, e)
117                                 {
118                                   _this.grid.footer.onClick('first');
119                                 },
120                                 render : function (_self)
121                                 {
122                                     _this.searchBox = _self;
123                                 }
124                             }
125                         },
126                         {
127                             xtype: 'Button',
128                             xns: Roo.Toolbar,
129                             listeners : {
130                                 click : function (_self, e)
131                                 {
132                                     _this.grid.footer.onClick('first');
133                                 }
134                             },
135                             cls : 'x-btn-icon',
136                             icon : rootURL + '/Pman/templates/images/search.gif'
137                         },
138                         {
139                             xtype: 'Button',
140                             xns: Roo.Toolbar,
141                             listeners : {
142                                 click : function (_self, e)
143                                 {
144                                     _this.searchBox.setValue('');
145                                     _this.grid.footer.onClick('first');\r
146                                 }
147                             },
148                             cls : 'x-btn-icon',
149                             icon : rootURL + '/Pman/templates/images/edit-clear.gif'
150                         },
151                         {
152                             xtype: 'Fill',
153                             xns: Roo.Toolbar
154                         },
155                         {
156                             xtype: 'Button',
157                             xns: Roo.Toolbar,
158                             listeners : {
159                                 click : function()
160                                 {
161                                 
162                                    Pman.Dialog.XtupleSalesOrderNew.show( { id : 0 } , function() {
163                                         _this.grid.footer.onClick('first');
164                                    }); 
165                                 }
166                             },
167                             cls : 'x-btn-text-icon',
168                             text : "Add",
169                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
170                         }
171                     ]
172                 },
173                 footer : {
174                     xtype: 'PagingToolbar',
175                     xns: Roo,
176                     displayInfo : true,
177                     emptyMsg : "No Metric found",
178                     pageSize : 50
179                 },
180                 colModel : [
181                     {
182                         xtype: 'ColumnModel',
183                         xns: Roo.grid,
184                         dataIndex : 'metric_id',
185                         header : 'ID',
186                         width : 75,
187                         renderer : function(v) { return String.format('{0}', v); }
188                     },
189                     {
190                         xtype: 'ColumnModel',
191                         xns: Roo.grid,
192                         dataIndex : 'metric_name',
193                         header : 'Name',
194                         width : 150,
195                         renderer : function(v) { return String.format('{0}', v); },
196                         editor : {
197                             xtype: 'GridEditor',
198                             xns: Roo.grid,
199                             field : {
200                                 xtype: 'TextField',
201                                 xns: Roo.form,
202                                 allowBlank : false
203                             }
204                         }
205                     },
206                     {
207                         xtype: 'ColumnModel',
208                         xns: Roo.grid,
209                         dataIndex : 'metric_value',
210                         header : 'Value',
211                         width : 150,
212                         renderer : function(v) { return String.format('{0}', v); },
213                         editor : {
214                             xtype: 'GridEditor',
215                             xns: Roo.grid,
216                             field : {
217                                 xtype: 'TextField',
218                                 xns: Roo.form,
219                                 allowBlank : false
220                             }
221                         }
222                     },
223                     {
224                         xtype: 'ColumnModel',
225                         xns: Roo.grid,
226                         dataIndex : 'metric_module',
227                         header : 'Module',
228                         width : 100,
229                         renderer : function(v) { return String.format('{0}', v); },
230                         editor : {
231                             xtype: 'GridEditor',
232                             xns: Roo.grid,
233                             field : {
234                                 xtype: 'TextField',
235                                 xns: Roo.form,
236                                 allowBlank : false
237                             }
238                         }
239                     }
240                 ]
241             }
242         };
243     }
244 });