Pman.Tab.XtupleCurrency.bjs
[Pman.Xtuple] / Pman.Tab.XtupleCurrency.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.XtupleCurrency = new Roo.XComponent({
6     part     :  ["Xtuple","Currency"],
7     order    : '001-Pman.Tab.XtupleCurrency',
8     region   : '',
9     parent   : false,
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: 'NestedLayoutPanel',
19             xns: Roo,
20             layout : {
21                 xtype: 'BorderLayout',
22                 xns: Roo,
23                 items : [
24                     {
25                         xtype: 'GridPanel',
26                         xns: Roo,
27                         title : "curr_symbol",
28                         fitToframe : true,
29                         fitContainer : true,
30                         tableName : 'curr_symbol',
31                         background : true,
32                         region : 'center',
33                         listeners : {
34                             activate : function() {
35                                 _this.panel = this;
36                                 if (_this.grid) {
37                                     _this.grid.footer.onClick('first');
38                                 }
39                             }
40                         },
41                         grid : {
42                             xtype: 'Grid',
43                             xns: Roo.grid,
44                             autoExpandColumn : 'curr_name',
45                             loadMask : true,
46                             listeners : {
47                                 render : function() 
48                                 {
49                                     _this.grid = this; 
50                                     //_this.dialog = Pman.Dialog.FILL_IN
51                                     if (_this.panel.active) {
52                                        this.footer.onClick('first');
53                                     }
54                                 },
55                                 rowdblclick : function (_self, rowIndex, e)
56                                 {
57                                     if (!_this.dialog) return;
58                                     _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
59                                         _this.grid.footer.onClick('first');
60                                     }); 
61                                 }
62                             },
63                             dataSource : {
64                                 xtype: 'Store',
65                                 xns: Roo.data,
66                                 remoteSort : true,
67                                 sortInfo : { field : 'curr_name', direction: 'ASC' },
68                                 proxy : {
69                                     xtype: 'HttpProxy',
70                                     xns: Roo.data,
71                                     method : 'GET',
72                                     url : baseURL + '/Roo/curr_symbol.php'
73                                 },
74                                 reader : {
75                                     xtype: 'JsonReader',
76                                     xns: Roo.data,
77                                     totalProperty : 'total',
78                                     root : 'data',
79                                     id : 'id',
80                                     fields : [
81                                         {
82                                             'name': 'curr_id',
83                                             'type': 'int'
84                                         },
85                                         {
86                                             'name': 'curr_base',
87                                             'type': 'int'
88                                         },
89                                         {
90                                             'name': 'curr_name',
91                                             'type': 'string'
92                                         },
93                                         {
94                                             'name': 'curr_symbol',
95                                             'type': 'string'
96                                         },
97                                         {
98                                             'name': 'curr_abbr',
99                                             'type': 'string'
100                                         }
101                                     ]
102                                 }
103                             },
104                             footer : {
105                                 xtype: 'PagingToolbar',
106                                 xns: Roo,
107                                 pageSize : 25,
108                                 displayInfo : true,
109                                 displayMsg : "Displaying curr_symbol{0} - {1} of {2}",
110                                 emptyMsg : "No curr_symbol found"
111                             },
112                             toolbar : {
113                                 xtype: 'Toolbar',
114                                 xns: Roo,
115                                 items : [
116                                     {
117                                         xtype: 'Button',
118                                         xns: Roo.Toolbar,
119                                         text : "Add",
120                                         cls : 'x-btn-text-icon',
121                                         icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
122                                         listeners : {
123                                             click : function()
124                                             {
125                                                 if (!_this.dialog) return;
126                                                 _this.dialog.show( { id : 0 } , function() {
127                                                     _this.grid.footer.onClick('first');
128                                                }); 
129                                             }
130                                         }
131                                     },
132                                     {
133                                         xtype: 'Button',
134                                         xns: Roo.Toolbar,
135                                         text : "Edit",
136                                         cls : 'x-btn-text-icon',
137                                         icon : Roo.rootURL + 'images/default/tree/leaf.gif',
138                                         listeners : {
139                                             click : function()
140                                             {
141                                                 var s = _this.grid.getSelectionModel().getSelections();
142                                                 if (!s.length || (s.length > 1))  {
143                                                     Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
144                                                     return;
145                                                 }
146                                                 if (!_this.dialog) return;
147                                                 _this.dialog.show(s[0].data, function() {
148                                                     _this.grid.footer.onClick('first');
149                                                 }); 
150                                                 
151                                             }
152                                         }
153                                     },
154                                     {
155                                         xtype: 'Button',
156                                         xns: Roo.Toolbar,
157                                         text : "Delete",
158                                         cls : 'x-btn-text-icon',
159                                         icon : rootURL + '/Pman/templates/images/trash.gif',
160                                         listeners : {
161                                             click : function()
162                                             {
163                                                  Pman.genericDelete(_this, 'curr_symbol'); 
164                                             }
165                                         }
166                                     }
167                                 ]
168                             },
169                             colModel : [
170                                 {
171                                     xtype: 'ColumnModel',
172                                     xns: Roo.grid,
173                                     header : 'Curr',
174                                     width : 75,
175                                     dataIndex : 'curr_id',
176                                     renderer : function(v) { return String.format('{0}', v); }
177                                 },
178                                 {
179                                     xtype: 'ColumnModel',
180                                     xns: Roo.grid,
181                                     header : 'Curr base',
182                                     width : 75,
183                                     dataIndex : 'curr_base',
184                                     renderer : function(v) { return String.format('{0}', v); }
185                                 },
186                                 {
187                                     xtype: 'ColumnModel',
188                                     xns: Roo.grid,
189                                     header : 'Curr name',
190                                     width : 200,
191                                     dataIndex : 'curr_name',
192                                     renderer : function(v) { return String.format('{0}', v); }
193                                 },
194                                 {
195                                     xtype: 'ColumnModel',
196                                     xns: Roo.grid,
197                                     header : 'Curr symbol',
198                                     width : 200,
199                                     dataIndex : 'curr_symbol',
200                                     renderer : function(v) { return String.format('{0}', v); }
201                                 },
202                                 {
203                                     xtype: 'ColumnModel',
204                                     xns: Roo.grid,
205                                     header : 'Curr abbr',
206                                     width : 200,
207                                     dataIndex : 'curr_abbr',
208                                     renderer : function(v) { return String.format('{0}', v); }
209                                 }
210                             ]
211                         }
212                     }
213                 ],
214                 west : {
215                     xtype: 'LayoutRegion',
216                     xns: Roo
217                 },
218                 center : {
219                     xtype: 'LayoutRegion',
220                     xns: Roo
221                 }
222             }
223         };
224     }
225 });