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