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                     beforeedit : function (e)
46                     {
47                     
48                     }
49                 },
50                 autoExpandColumn : 'metric_value',
51                 clicksToEdit : 1,
52                 loadMask : true,
53                 dataSource : {
54                     xtype: 'Store',
55                     xns: Roo.data,
56                     listeners : {
57                         beforeload : function (_self, o){
58                             o.params = o.params || {};
59                             
60                             var s = _this.searchBox.getValue();
61                             
62                             if(!s || !s.length){
63                                 return;
64                             }
65                             
66                             o.params['search[name]'] = s;
67                         }
68                     },
69                     remoteSort : true,
70                     sortInfo : { field : 'metric_name', direction: 'ASC' },
71                     proxy : {
72                         xtype: 'HttpProxy',
73                         xns: Roo.data,
74                         method : 'GET',
75                         timeout : 90000,
76                         url : baseURL + '/Xtuple/Roo/Metric.php'
77                     },
78                     reader : {
79                         xtype: 'JsonReader',
80                         xns: Roo.data,
81                         id : 'metric_id',
82                         root : 'data',
83                         totalProperty : 'total',
84                         fields : [
85                             {
86                                 'name': 'metric_id',
87                                 'type': 'int'
88                             },
89                             {
90                                 'name': 'metric_name',
91                                 'type': 'string'
92                             },
93                             {
94                                 'name': 'metric_value',
95                                 'type': 'string'
96                             },
97                             {
98                                 'name': 'metric_module',
99                                 'type': 'string'
100                             }
101                         ]
102                     }
103                 },
104                 toolbar : {
105                     xtype: 'Toolbar',
106                     xns: Roo,
107                     items : [
108                         {
109                             xtype: 'TextField',
110                             xns: Roo.form,
111                             listeners : {
112                                 specialkey : function (_self, e)
113                                 {
114                                   _this.grid.footer.onClick('first');
115                                 },
116                                 render : function (_self)
117                                 {
118                                     _this.searchBox = _self;
119                                 }
120                             }
121                         },
122                         {
123                             xtype: 'Button',
124                             xns: Roo.Toolbar,
125                             listeners : {
126                                 click : function (_self, e)
127                                 {
128                                     _this.grid.footer.onClick('first');
129                                 }
130                             },
131                             cls : 'x-btn-icon',
132                             icon : rootURL + '/Pman/templates/images/search.gif'
133                         },
134                         {
135                             xtype: 'Button',
136                             xns: Roo.Toolbar,
137                             listeners : {
138                                 click : function (_self, e)
139                                 {
140                                     _this.searchBox.setValue('');
141                                     _this.grid.footer.onClick('first');\r
142                                 }
143                             },
144                             cls : 'x-btn-icon',
145                             icon : rootURL + '/Pman/templates/images/edit-clear.gif'
146                         },
147                         {
148                             xtype: 'Fill',
149                             xns: Roo.Toolbar
150                         },
151                         {
152                             xtype: 'Button',
153                             xns: Roo.Toolbar,
154                             listeners : {
155                                 click : function()
156                                 {
157                                 
158                                    Pman.Dialog.XtupleSalesOrderNew.show( { id : 0 } , function() {
159                                         _this.grid.footer.onClick('first');
160                                    }); 
161                                 }
162                             },
163                             cls : 'x-btn-text-icon',
164                             text : "Add",
165                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
166                         }
167                     ]
168                 },
169                 footer : {
170                     xtype: 'PagingToolbar',
171                     xns: Roo,
172                     displayInfo : true,
173                     emptyMsg : "No Metric found",
174                     pageSize : 50
175                 },
176                 colModel : [
177                     {
178                         xtype: 'ColumnModel',
179                         xns: Roo.grid,
180                         dataIndex : 'metric_id',
181                         header : 'ID',
182                         width : 75,
183                         renderer : function(v) { return String.format('{0}', v); }
184                     },
185                     {
186                         xtype: 'ColumnModel',
187                         xns: Roo.grid,
188                         dataIndex : 'metric_name',
189                         header : 'Name',
190                         width : 150,
191                         renderer : function(v) { return String.format('{0}', v); }
192                     },
193                     {
194                         xtype: 'ColumnModel',
195                         xns: Roo.grid,
196                         dataIndex : 'metric_value',
197                         header : 'Value',
198                         width : 150,
199                         renderer : function(v) { return String.format('{0}', v); }
200                     },
201                     {
202                         xtype: 'ColumnModel',
203                         xns: Roo.grid,
204                         dataIndex : 'metric_module',
205                         header : 'Module',
206                         width : 100,
207                         renderer : function(v) { return String.format('{0}', v); }
208                     }
209                 ]
210             }
211         };
212     }
213 });