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