Pman.Tab.BuilderPalette.js
[Pman.Builder] / Pman.Tab.BuilderPalette.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5
6
7 // register the module first
8 Pman.on('beforeload', function()
9 {
10     Pman.register({
11         modKey : '001-Pman.Tab.BuilderPalette',
12         module : Pman.Tab.BuilderPalette,
13         region : 'center',
14         parent : Pman.Tab.BuilderTab,
15         name : "Pman.Tab.BuilderPalette",
16         disabled : false, 
17         permname: '' 
18     });
19 });
20
21 Pman.Tab.BuilderPalette = new Roo.util.Observable({
22
23     panel : false,
24     disabled : false,
25     parentLayout:  false,
26
27     add : function(parentLayout, region)
28     {
29
30         var _this = this;
31         this.parentLayout = parentLayout;
32
33         this.panel = parentLayout.addxtype({
34             xtype: 'GridPanel',
35             xns: Roo,
36             listeners : {
37                 activate : function() {
38                     _this.panel = this;
39                     if (_this.grid) {
40                        _this.grid.ds.load({})
41                     }
42                 }
43             },
44             background : true,
45             fitContainer : true,
46             fitToframe : true,
47             region : 'east',
48             tableName : 'palette',
49             title : "palette",
50             grid : {
51                 xtype: 'Grid',
52                 xns: Roo.grid,
53                 listeners : {
54                     render : function() 
55                     {
56                         _this.grid = this; 
57                         //_this.dialog = Pman.Dialog.FILL_IN
58                         if (_this.panel.active) {
59                            this.ds.load({})
60                         }
61                         if (_this.ss) {
62                             return;
63                         }
64                         _this.ss =   Roo.util.CSS.createStyleSheet(
65                     '.pman-builder-palete-hide { display: none; } ' + "\n" 
66                     , Roo.id())
67                         
68                         
69                         
70                     },
71                     rowclass : function (gridview, rowcfg)
72                     {
73                         var sn = Pman.Tab.BuilderTree.tree.currentNodeType();
74                         Roo.log(rowcfg);
75                         if (!sn) {
76                             sn = '*top';
77                         }
78                         var cls = 'pman-builder-palete-hide';
79                         var name  = rowcfg.record.data.name;
80                         return;
81                         Roo.each(rowcfg.record.hson.parents, function(n) {
82                             if (n == name || n.split(':').shift() == name) 
83                                 cls = '';
84                                 return true;
85                             }
86                          );
87                          rowcfg.rowClass = cls;
88                         // what is the currently selected element..
89                      
90                     }
91                 },
92                 autoExpandColumn : 'name',
93                 loadMask : true,
94                 dataSource : {
95                     xtype: 'Store',
96                     xns: Roo.data,
97                     remoteSort : true,
98                     sortInfo : { field : 'name', direction: 'ASC' },
99                     proxy : {
100                         xtype: 'HttpProxy',
101                         xns: Roo.data,
102                         method : 'GET',
103                         url : baseURL + '/Builder/Palette.php'
104                     },
105                     reader : {
106                         xtype: 'JsonReader',
107                         xns: Roo.data,
108                         id : 'id',
109                         root : 'data',
110                         totalProperty : 'total',
111                         fields : [
112                             
113                             {
114                                 'name': 'name',
115                                 'type': 'string'
116                             }
117                         ]
118                     }
119                 },
120                 colModel : [
121                     {
122                         xtype: 'ColumnModel',
123                         xns: Roo.grid,
124                         header : 'Name',
125                         width : 200,
126                         dataIndex : 'name',
127                         renderer : function(v) { return String.format('{0}', v); }
128                     }
129                 ]
130             }
131         });
132         this.layout = this.panel.layout;
133
134     }
135 });