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 west" ,
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" ,
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                             }
139                         },
140                     toolbar : {
141                         xtype: 'NavSimplebar',
142                         xns : Roo.bootstrap,
143                         items: [
144                             {
145                                 xtype: 'NavGroup',
146                                 xns: Roo.bootstrap,
147                                 items : [
148                                     {
149                                         xtype: 'NavItem',
150                                         xns: Roo.bootstrap,
151                                         html: 'a button'
152                                         
153                                     },
154                                     {
155                                         xtype: 'Input',
156                                         xns: Roo.bootstrap,
157                                         placeholder: 'a text input'
158                                         
159                                     }
160                                 ]
161                             }
162                         ]
163                         
164                     },
165                     grid : {
166                         loadMask : true,
167                         striped : true,
168                         xns : Roo.bootstrap,
169                         xtype : 'Table',
170                         cls : 'table-fixed',
171                         rowSelection : true,
172                         footer : {
173                             xtype : 'PagingToolbar',
174                             pageSize : 25,
175                             xns : Roo.bootstrap,
176                             '|xns' : 'Roo.bootstrap'
177                         },
178                         store : {
179                             xns : Roo.data,
180                             xtype : 'Store',
181                          
182                             proxy : {
183                                 xns : Roo.data,
184                                 xtype : 'MemoryProxy',
185                                 data: [
186                                     ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
187                                     ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
188                                     ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
189                                     ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
190                                     ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
191                                     ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
192                                     ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
193                                     ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
194                                     ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
195                                     ['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am'],
196                                     ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],
197                                     ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],
198                                     ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],
199                                     ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'] 
200                                 ]
201                             },
202                             reader : {
203                            
204                                 xns : Roo.data,
205                                 xtype : 'ArrayReader',
206                                 fields: [
207                                     {name: 'company'},
208                                     {name: 'price', type: 'float'},
209                                     {name: 'change', type: 'float'},
210                                     {name: 'pctChange', type: 'float'},
211                                     {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
212                                 ]
213                             },
214                         },
215                         cm : [
216                             
217                             {
218                                 id:'company',
219                                 header: "Company",
220                                 width: 160,
221                                 sortable: true,
222                                 locked:false,
223                                 dataIndex: 'company',
224                                 xns : Roo.grid,
225                                 xtype : 'ColumnModel'
226                             },
227                             {
228                                 header: "Price",
229                                width: 160,
230                                 sortable: true,
231                                 renderer: Roo.util.Format.usMoney,
232                                 dataIndex: 'price',
233                                 xns : Roo.grid,
234                                 xtype : 'ColumnModel'
235                             }
236                             
237                         ]
238                         
239                     }
240                 
241                 },
242                 {
243                     xtype : 'Content',
244                     xns: Roo.bootstrap.panel,
245                     title : "Title Center",
246                     fitToFrame:true,
247                     closable:false,
248                     region : 'center',
249                     html : 'some body center'
250                     
251                 },
252                 
253                 {
254                     xtype : 'Nest',
255                     title : "Title Nest Center",
256                     
257                     xns: Roo.bootstrap.panel,
258                     region : 'center',
259                     
260                     layout : {
261                         xtype : 'Border',
262                         xns: Roo.bootstrap.layout,
263                         south: {
264                             xtype : 'Region',
265                             xns: Roo.bootstrap.layout,
266                                 split:true,
267                                 initialSize: 200,
268                                 minSize: 100,
269                                 maxSize: 400,
270                                 autoScroll:true,
271                                 collapsible:true,
272                                 titlebar: true
273                             },
274                             center: {
275                             xtype : 'Region',
276                             xns: Roo.bootstrap.layout,
277                                 autoScroll:true,
278                             },
279                         items : [
280                             {
281                                 xtype : 'Content',
282                                 xns: Roo.bootstrap.panel,
283                                 title : "More Info",
284                                 region : 'south',
285                                 html : 'some body south'
286                             },
287                             {
288                                 xtype : 'Content',
289                                 xns: Roo.bootstrap.panel,
290                                 title : "the body",
291                                 region : 'center',
292                                 html : 'some body center'
293                             },
294                         ]
295                     }
296                 
297                     
298                 }
299                  
300             ]   
301             
302         }
303     }
304 });
305   
306    Roo.onReady(function() {
307         Roo.XComponent.is_alt = true;
308           Roo.XComponent.build();
309           //dRoo.bootstrap.Tooltip.init();
310       });