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                        
80                      
81                         Roo.each(rowcfg.record.json.parents, function(n) {
82                             if (n == sn || n.split(':').shift() == sn) 
83                                 cls = '';
84                                 return true;
85                             }
86                          );
87                          Roo.log(cls);
88                          rowcfg.rowClass = cls;
89                         // what is the currently selected element..
90                      
91                     }
92                 },
93                 autoExpandColumn : 'name',
94                 loadMask : true,
95                 dataSource : {
96                     xtype: 'Store',
97                     xns: Roo.data,
98                     remoteSort : true,
99                     sortInfo : { field : 'name', direction: 'ASC' },
100                     proxy : {
101                         xtype: 'HttpProxy',
102                         xns: Roo.data,
103                         method : 'GET',
104                         url : baseURL + '/Builder/Palette.php'
105                     },
106                     reader : {
107                         xtype: 'JsonReader',
108                         xns: Roo.data,
109                         id : 'id',
110                         root : 'data',
111                         totalProperty : 'total',
112                         fields : [
113                             
114                             {
115                                 'name': 'name',
116                                 'type': 'string'
117                             }
118                         ]
119                     }
120                 },
121                 colModel : [
122                     {
123                         xtype: 'ColumnModel',
124                         xns: Roo.grid,
125                         header : 'Name',
126                         width : 200,
127                         dataIndex : 'name',
128                         renderer : function(v) { return String.format('{0}', v); }
129                     }
130                 ]
131             }
132         });
133         this.layout = this.panel.layout;
134
135     }
136 });