5432da42eb52371602085cfc11ae4bf4243989f9
[app.Builder.js] / Builder / Provider / Templates / Roo.GridPanel.js
1 {
2     xtype : 'GridPanel',
3     title : "test",
4     fitToframe : true,
5     fitContainer : true,
6     tableName : 'test',
7     background : true,
8     listeners : {
9         activate: function() {
10             _this.panel = this;
11             if (_this.grid) {
12                 _this.grid.footer.onClick('first');
13             }
14         }
15     },
16     grid : {
17         xtype : 'Grid',
18         autoExpandColumn : 'test',
19         loadMask : true,
20         listeners : {
21             render: function() { 
22                 _this.grid = this; 
23             
24                 if (_this.panel.active) {
25                    this.footer.onClick('first');
26                 }
27             }
28         },
29         dataSource : {
30             xtype : 'Store',
31             reader: Pman.Readers.Cash_transaction_split,
32             proxy : {
33                 xtype : 'HttpProxy',
34                 method : 'GET',
35                 url: baseURL + 'YOUR URL"
36             }
37         },
38         colModel : [
39             {
40                 header : 'Col1',
41                 width : 100,
42                 dataIndex : 'test',
43                 renderer: function(v) { return String.format('{0}', v); }
44             },
45              
46         ],
47         footer : {
48             xtype : 'PagingToolbar',
49             pageSize : 25,
50             displayInfo : true,
51             displayMsg : "Displaying cash_transaction_split  {0} - {1} of {2}",
52             emptyMsg : "No cash_transaction_split found"
53         },
54         toolbar : {
55             xtype : 'Toolbar',
56             items : [
57                 {
58                     text : "Add",
59                     xtype : 'Button',
60                     cls : 'x-btn-text-icon',
61                     icon: Roo.rootURL + 'images/default/dd/drop-add.gif',
62                     listeners : {
63                         click: " function() { }"
64                                 
65                     }
66                 },
67                 {
68                     text : "Edit",
69                     xtype : 'Button',
70                     cls : 'x-btn-text-icon',
71                     icon: Roo.rootURL + 'images/default/tree/leaf.gif',
72                     listeners : {
73                         click: function()
74                                 {
75                                     var s = _this.grid.getSelectionModel().getSelections();
76                                     if (!s.length || (s.length > 1))  {
77                                         Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
78                                         return;
79                                     }
80                                     
81                                     _this.dialog.show(s[0].data, function() {
82                                         _this.grid.footer.onClick('first');
83                                        }); 
84                                     
85                                 }
86                                 
87                     }
88                 },
89                 {
90                     text : "Delete",
91                     cls : 'x-btn-text-icon',
92                     icon: rootURL + '/Pman/templates/images/trash.gif',
93                     xtype : 'Button',
94                     listeners : {
95                         click: function()
96                                 {
97                                 Pman.genericDelete(_this, _this.grid.tableName); 
98                                 }
99                                 
100                     }
101                 }
102             ]
103         }
104     },
105     region : 'center'
106 }
107