Pman.Tab.CmsCategoryType.bjs
[Pman.Cms] / Pman.Tab.CmsCategoryType.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.CmsCategoryType = new Roo.XComponent({
6     part     :  ["Cms","CategoryType"],
7     order    : '001-Pman.Tab.CmsCategoryType',
8     region   : 'center',
9     parent   : 'Pman.Tab.Cms',
10     name     : "Pman.Tab.CmsCategoryType",
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             },
29             background : true,
30             fitContainer : true,
31             fitToframe : true,
32             region : 'center',
33             tableName : 'cms_category_type',
34             title : "Category Types",
35             grid : {
36                 xtype: 'Grid',
37                 xns: Roo.grid,
38                 listeners : {
39                     render : function() 
40                     {
41                         _this.grid = this; 
42                         _this.dialog = Pman.Dialog.CmsCategoryType;
43                         if (_this.panel.active) {
44                            this.footer.onClick('first');
45                         }
46                     },
47                     rowdblclick : function (_self, rowIndex, e)
48                     {
49                         if (!_this.dialog) return;
50                         _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
51                             _this.grid.footer.onClick('first');
52                         }); 
53                     }
54                 },
55                 autoExpandColumn : 'name',
56                 loadMask : true,
57                 dataSource : {
58                     xtype: 'Store',
59                     xns: Roo.data,
60                     remoteSort : true,
61                     sortInfo : { field : 'name', direction: 'ASC' },
62                     proxy : {
63                         xtype: 'HttpProxy',
64                         xns: Roo.data,
65                         method : 'GET',
66                         url : baseURL + '/Roo/cms_category_type.php'
67                     },
68                     reader : {
69                         xtype: 'JsonReader',
70                         xns: Roo.data,
71                         totalProperty : 'total',
72                         root : 'data',
73                         id : 'id',
74                         fields : [
75                             {
76                                 'name': 'id',
77                                 'type': 'int'
78                             },
79                             {
80                                 'name': 'name',
81                                 'type': 'string'
82                             }
83                         ]
84                     }
85                 },
86                 footer : {
87                     xtype: 'PagingToolbar',
88                     xns: Roo,
89                     pageSize : 25,
90                     displayInfo : true,
91                     displayMsg : "Displaying cms_category_type{0} - {1} of {2}",
92                     emptyMsg : "No cms_category_type found"
93                 },
94                 toolbar : {
95                     xtype: 'Toolbar',
96                     xns: Roo,
97                     items : [
98                         {
99                             xtype: 'Fill',
100                             xns: Roo.Toolbar
101                         },
102                         {
103                             xtype: 'Button',
104                             xns: Roo.Toolbar,
105                             text : "Add",
106                             cls : 'x-btn-text-icon',
107                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
108                             listeners : {
109                                 click : function()
110                                 {
111                                     if (!_this.dialog) return;
112                                     _this.dialog.show( { id : 0 } , function() {
113                                         _this.grid.footer.onClick('first');
114                                    }); 
115                                 }
116                             }
117                         },
118                         {
119                             xtype: 'Button',
120                             xns: Roo.Toolbar,
121                             listeners : {
122                                 click : function()
123                                 {
124                                     var s = _this.grid.getSelectionModel().getSelections();
125                                     if (!s.length || (s.length > 1))  {
126                                         Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
127                                         return;
128                                     }
129                                     if (!_this.dialog) return;
130                                     _this.dialog.show(s[0].data, function() {
131                                         _this.grid.footer.onClick('first');
132                                     }); 
133                                     
134                                 }
135                             },
136                             cls : 'x-btn-text-icon',
137                             text : "Edit",
138                             icon : Roo.rootURL + 'images/default/tree/leaf.gif'
139                         },
140                         {
141                             xtype: 'Button',
142                             xns: Roo.Toolbar,
143                             text : "Delete",
144                             cls : 'x-btn-text-icon',
145                             icon : rootURL + '/Pman/templates/images/trash.gif',
146                             listeners : {
147                                 click : function()
148                                 {
149                                      Pman.genericDelete(_this, 'cms_category_type'); 
150                                 }
151                             }
152                         }
153                     ]
154                 },
155                 colModel : [
156                     {
157                         xtype: 'ColumnModel',
158                         xns: Roo.grid,
159                         header : 'Name',
160                         width : 200,
161                         dataIndex : 'name',
162                         renderer : function(v) { return String.format('{0}', v); }
163                     }
164                 ]
165             }
166         };
167     }
168 });