examples/bootstrap/nested.js
[roojs1] / examples / bootstrap / nested.js
1
2 Roo.namespace("Example");
3
4 Example.Nested = new Roo.XComponent({
5     part     :  ["example", "nested" ],
6     order    : '001-Example-Nested',
7     region   : 'center',
8     parent   : false,
9     name     : "unnamed module",
10     disabled : false, 
11     permname : '', 
12     _tree : function()
13     {
14         var _this = this;
15         var MODULE = this;
16         return {
17             is_root : true,
18             xtype : 'Border',
19             xns : Roo.bootstrap.layout,
20             el : document.body, // border layout can be applied to the outer one...
21             west: {
22                 xtype : 'Region',
23                 xns: Roo.bootstrap.layout,
24                 split:true,
25                 tabPosition: 'top',
26                 initialSize: 400,
27                 titlebar: true,
28                // collapsible: true,
29                 minSize: 100,
30                 maxSize: 500
31             },
32             north: {
33                 xtype : 'Region',
34                 xns: Roo.bootstrap.layout,
35                 overflow : 'visible',
36                 
37                 initialSize: 50,
38                 titlebar: false
39                
40             },
41             center: {
42                 xtype : 'Region',
43                 xns: Roo.bootstrap.layout,
44                 autoScroll: false,
45                 tabPosition:'top',
46                  titlebar: true
47             },
48             items : [
49                 {
50                     xtype : 'Content',
51                     xns: Roo.bootstrap.panel,
52                     title : "Title north" ,
53                     fitToFrame:true,
54                     closable:false,
55                     region : 'north',
56                     items : [
57                         {
58                             bar : true,
59                             position : 'static-top',
60                             xtype : 'NavHeaderbar',
61                             tag : 'nav',
62                             xns : Roo.bootstrap,
63                             items : [
64                                 {
65                                     cls : 'navbar-btn sidebar-toggle',
66                                     xtype : 'Link',
67                                     xns : Roo.bootstrap,
68                                     html : '<span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span>'
69                                 },
70                                 {
71                                     xtype : 'NavGroup',
72                                     align : 'right',
73                                     xns : Roo.bootstrap,
74                                     items : [
75                                         {
76                                             menu : {
77                                                 xtype : 'Menu',
78                                                 xns : Roo.bootstrap,
79                                                 items : [
80                                                     {
81                                                         xtype : 'MenuItem',
82                                                         xns : Roo.bootstrap,
83                                                         html : 'test'
84                                                     }
85                                                 ]
86         
87                                             },
88                                             xtype : 'NavItem',
89                                             xns : Roo.bootstrap,
90                                             listeners : {
91                                                 click : function()
92                                                 {
93                                                    // Example.NestedDialog.show({});
94                                                 }
95                                             },
96                                             html : 'test dialog',
97                                             items : [
98         
99                                             ]
100         
101                                         },
102                                         {
103                                             xtype : 'NavItem',
104                                             xns : Roo.bootstrap,
105                                             html : 'test'
106                                         }
107                                     ]
108         
109                                 }
110                             ]
111         
112                         }
113                     ]
114                     
115                 },
116              
117                 {
118                     xtype : 'Content',
119                     xns: Roo.bootstrap.panel,
120                     title : "Title west a" ,
121                     fitToFrame:true,
122                     closable:false,
123                     region : 'west',
124                     html : 'some body west'
125                     
126                 },
127                 {
128                     xtype : 'Grid',
129                     xns: Roo.bootstrap.panel,
130                     title : "Test Grid",
131                     fitToFrame:true,
132                     closable:false,
133                     region : 'west',
134                     listeners : {
135                             activate : function()
136                             {
137                               //  this.grid.store.load.defer(100, this.grid.store);
138                                 this.grid.footer.onClick('first');
139                             }
140                         },
141                     toolbar : {
142                          xtype: 'NavGroup',
143                         xns: Roo.bootstrap,
144                         items : [
145                             {
146                                 xtype: 'NavItem',
147                                 xns: Roo.bootstrap,
148                                 html: 'a button'
149                                 
150                             },
151                             {
152                                 xtype: 'Input',
153                                 xns: Roo.bootstrap,
154                                 placeholder: 'a text input'
155                                 
156                             }
157                         ]
158                     
159                 
160                         
161                     },
162                     grid : {
163                         loadMask : true,
164                         striped : true,
165                         xns : Roo.bootstrap,
166                         xtype : 'Table',
167                         cls : 'table-fixed',
168                         rowSelection : true,
169                         footer : {
170                             xtype : 'PagingToolbar',
171                             pageSize : 25,
172                             xns : Roo.bootstrap,
173                             '|xns' : 'Roo.bootstrap'
174                         },
175                         store : {
176                             xns : Roo.data,
177                             xtype : 'Store',
178                          
179                             proxy : {
180                                 xns : Roo.data,
181                                 xtype : 'MemoryProxy',
182                                 data: [
183                                     ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
184                                     ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
185                                     ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
186                                     ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
187                                     ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
188                                     ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
189                                     ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
190                                     ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
191                                     ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
192                                     ['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am'],
193                                     ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],
194                                     ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],
195                                     ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],
196                                     ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'] 
197                                 ]
198                             },
199                             reader : {
200                            
201                                 xns : Roo.data,
202                                 xtype : 'ArrayReader',
203                                 fields: [
204                                     {name: 'company'},
205                                     {name: 'price', type: 'float'},
206                                     {name: 'change', type: 'float'},
207                                     {name: 'pctChange', type: 'float'},
208                                     {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
209                                 ]
210                             },
211                         },
212                         cm : [
213                             
214                             {
215                                 id:'company',
216                                 header: "Company",
217                                 width: 160,
218                                 sortable: true,
219                                 locked:false,
220                                 dataIndex: 'company',
221                                 xns : Roo.grid,
222                                 xtype : 'ColumnModel'
223                             },
224                             {
225                                 header: "Price",
226                                width: 160,
227                                 sortable: true,
228                                 renderer: Roo.util.Format.usMoney,
229                                 dataIndex: 'price',
230                                 xns : Roo.grid,
231                                 xtype : 'ColumnModel'
232                             }
233                             
234                         ]
235                         
236                     }
237                 
238                 },
239                 {
240                     xtype : 'Content',
241                     xns: Roo.bootstrap.panel,
242                     title : "Title Center",
243                     fitToFrame:true,
244                     closable:false,
245                     region : 'center',
246                     html : 'some body center'
247                     
248                 },
249                 
250                 {
251                     xtype : 'Nest',
252                     title : "Title Nest Center",
253                     
254                     xns: Roo.bootstrap.panel,
255                     region : 'center',
256                     
257                     layout : {
258                         xtype : 'Border',
259                         xns: Roo.bootstrap.layout,
260                         south: {
261                             xtype : 'Region',
262                             xns: Roo.bootstrap.layout,
263                                 split:true,
264                                 initialSize: 200,
265                                 minSize: 100,
266                                 maxSize: 400,
267                                 autoScroll:true,
268                                 collapsible:true,
269                                 titlebar: true
270                             },
271                             center: {
272                             xtype : 'Region',
273                             xns: Roo.bootstrap.layout,
274                                 autoScroll:true,
275                             },
276                         items : [
277                             {
278                                 xtype : 'Content',
279                                 xns: Roo.bootstrap.panel,
280                                 title : "More Info",
281                                 region : 'south',
282                                 html : 'some body south'
283                             },
284                             {
285                                 xtype : 'Content',
286                                 xns: Roo.bootstrap.panel,
287                                 title : "the body",
288                                 region : 'center',
289                                 html : 'some body center'
290                             },
291                         ]
292                     }
293                 
294                     
295                 }
296                  
297             ]   
298             
299         }
300     }
301 });
302    
303    Roo.onReady(function() {
304         Roo.XComponent.is_alt = true;
305           Roo.XComponent.build();
306           //dRoo.bootstrap.Tooltip.init();
307       });