examples/bootstrap/TabPanel-ComboBox.js
[roojs1] / examples / bootstrap / TabPanel-ComboBox.js
1
2
3 Roo.example = Roo.example || {};
4
5 Roo.example.TabPanelCombobox = new Roo.XComponent({
6     part     :  ["layout","viewpanel"],
7     order    : '001-viewpanel',
8     region   : '',
9     parent   : '#bootstrap',
10     name     : "unnamed module",
11     disabled : false, 
12     permname : '', 
13     _tree : function()
14     {
15         
16         this.parent = {
17             el : new Roo.bootstrap.Body()
18         }
19         this.parent.el.layout = false;
20         this.parent.el.render(document.body);
21         
22         var _this = this;
23         var MODULE = this;
24         var baseURL = '/web.eventmanager/demo.local.php';
25         
26         return {
27             xtype: 'Body',
28             xns: Roo.bootstrap,
29             items : [
30                  {
31                     xtype : 'Container',
32                     cls : 'content',
33                     xns : Roo.bootstrap,
34                     style : 'margin-top:100px',
35                     items : [
36                         {
37                             xtype : 'Container',
38                             cls : 'pad-wrapper',
39                             xns : Roo.bootstrap,
40                             items : [
41                                 {
42                                     xtype : 'Container',
43                                     cls : 'container alpha',
44                                     xns : Roo.bootstrap,
45                                     items : [
46                                         {
47                                             xtype : 'Container',
48                                             xns : Roo.bootstrap,
49                                             items : [
50                                                 {
51                                                     xtype : 'NavSimplebar',
52                                                     xns : Roo.bootstrap,
53                                                     items : [
54                                                         {
55                                                             navId : '#top',
56                                                             xtype : 'NavGroup',
57                                                             xns : Roo.bootstrap,
58                                                             type : 'pills',
59                                                             listeners : {
60                                                                 render : function (_self)
61                                                                    {
62                                                                         _this.navGroup = this;
63                                                                    }
64                                                             },
65                                                             items : [
66                                                                 {
67                                                                     tabId : '#normal',
68                                                                     xtype : 'NavItem',
69                                                                     preventDefault : true,
70                                                                     html : 'Normal',
71                                                                     xns : Roo.bootstrap,
72                                                                     active : true,
73                                                                     listeners : {
74                                                                         render : function (_self)
75                                                                            {
76                                                                               _this.normal = this;
77                                                                               
78                                                                            }
79                                                                     }
80                                                                 },
81                                                                 {
82                                                                     tabId : '#multiple',
83                                                                     xtype : 'NavItem',
84                                                                     preventDefault : true,
85                                                                     html : 'Multiple',
86                                                                     xns : Roo.bootstrap,
87                                                                     active : false,
88                                                                     listeners : {
89                                                                         render : function (_self)
90                                                                            {
91                                                                               _this.multiple = this;
92                                                                               
93                                                                            }
94                                                                     }
95                                                                 },
96                                                                 {
97                                                                     tabId : '#tickable',
98                                                                     xtype : 'NavItem',
99                                                                     preventDefault : true,
100                                                                     html : 'Tickable',
101                                                                     xns : Roo.bootstrap,
102                                                                     active : false,
103                                                                     listeners : {
104                                                                         render : function (_self)
105                                                                            {
106                                                                               _this.tickable = this;
107                                                                               
108                                                                            }
109                                                                     }
110                                                                 }
111                                                             ]
112
113                                                         }
114                                                     ]
115
116                                                 },
117                                                 {
118                                                     xtype : 'TabGroup',
119                                                     style : 'margin-top:20px;',
120                                                     xns : Roo.bootstrap,
121                                                     navId : '#top',
122                                                     carousel : true,
123                                                     items : [
124                                                         {
125                                                             tabId : '#normal',
126                                                             xtype : 'TabPanel',
127                                                             xns : Roo.bootstrap,
128                                                             navId : '#top',
129                                                             active : true,
130                                                             items : [
131                                                                 {
132                                                                     level : 4,
133                                                                     xtype : 'Header',
134                                                                     html : 'First TabPanel With ComboBox',
135                                                                     xns : Roo.bootstrap
136                                                                 },
137                                                                 {
138                                                                     xtype : 'Container',
139                                                                     well : 'md',
140                                                                     xns : Roo.bootstrap,
141                                                                     items : [
142                                                                         {
143                                                                             xtype : 'Row',
144                                                                             xns : Roo.bootstrap,
145                                                                             items : [
146                                                                                 {
147                                                                                     md : 12,
148                                                                                     xtype : 'Column',
149                                                                                     xns : Roo.bootstrap,
150                                                                                     items : [
151                                                                                         {
152                                                                                             xtype: 'ComboBox',
153                                                                                             xns: Roo.bootstrap,
154                                                                                             placeholder : 'Select a country',
155                                                                                             displayField : 'name',
156                                                                                             hiddenName : 'country_id',
157                                                                                             md : '12',
158                                                                                             size : 'sm',
159                                                                                             name : 'country_id_name',
160                                                                                             triggerAction : 'all',
161                                                                                             minChars : '1',
162                                                                                             tpl : '<li class="select2-result"><b>{name}</b></div>',
163                                                                                             style : 'margin-top:20px;',
164                                                                                             listeners : {
165                                                                                                 render : function (_self) {
166                                                                                                     _this.normalSel = _self;
167                                                                                                 }
168                                                                                             },
169                                                                                             forceSelection : true,
170                                                                                             valueField : 'id',
171                                                                                             queryParam : 'query[name]',
172                                                                                             editable : true,
173                                                                                             alwaysQuery : true,
174                                                                                             allowBlank : false,
175                                                                                             fieldLabel : 'Country Normal',
176                                                                                             store : {
177                                                                                                 xtype: 'Store',
178                                                                                                 xns: Roo.data,
179                                                                                                 listeners : {
180                                                                                                     beforeload : function (_self, o) {
181                                                                                                         o.params = o.params || {};
182
183                                                                                                     }
184                                                                                                 },
185                                                                                                 remoteSort : true,
186                                                                                                 sortInfo : { direction : 'ASC', field: 'name' },
187                                                                                                 proxy : {
188                                                                                                     xtype: 'HttpProxy',
189                                                                                                     xns: Roo.data,
190                                                                                                     url : baseURL + '/Geoip/Core_geoip_country',
191                                                                                                     method : 'GET'
192                                                                                                 },
193                                                                                                 reader : {
194                                                                                                     xtype: 'JsonReader',
195                                                                                                     xns: Roo.data,
196                                                                                                     fields : [
197                                                                                                         {
198                                                                                                             'name': 'id',
199                                                                                                             'type': 'int'
200                                                                                                         },
201                                                                                                         {
202                                                                                                             'name': 'code',
203                                                                                                             'type': 'string'
204                                                                                                         },
205                                                                                                         {
206                                                                                                             'name': 'name',
207                                                                                                             'type': 'string'
208                                                                                                         }
209                                                                                                     ]
210                                                                                                 }
211                                                                                             }
212                                                                                         }
213                                                                                     ]
214
215                                                                                 }
216                                                                             ]
217
218                                                                         }
219                                                                     ]
220
221                                                                 }
222                                                             ]
223
224                                                         },
225                                                         {
226                                                             tabId : '#multiple',
227                                                             xtype : 'TabPanel',
228                                                             xns : Roo.bootstrap,
229                                                             navId : '#top',
230                                                             active : false,
231                                                             items : [
232                                                                 {
233                                                                     level : 4,
234                                                                     xtype : 'Header',
235                                                                     html : 'First TabPanel With ComboBox',
236                                                                     xns : Roo.bootstrap
237                                                                 },
238                                                                 {
239                                                                     xtype : 'Container',
240                                                                     well : 'md',
241                                                                     xns : Roo.bootstrap,
242                                                                     items : [
243                                                                         {
244                                                                             xtype : 'Row',
245                                                                             xns : Roo.bootstrap,
246                                                                             items : [
247                                                                                 {
248                                                                                     md : 12,
249                                                                                     xtype : 'Column',
250                                                                                     xns : Roo.bootstrap,
251                                                                                     items : [
252                                                                                         {
253                                                                                             xtype: 'ComboBox',
254                                                                                             xns: Roo.bootstrap,
255                                                                                             placeholder : 'Select a country',
256                                                                                             displayField : 'name',
257                                                                                             hiddenName : 'country_id',
258                                                                                             md : '12',
259                                                                                             size : 'sm',
260                                                                                             name : 'country_id_name',
261                                                                                             triggerAction : 'all',
262                                                                                             minChars : '1',
263                                                                                             tpl : '<li class="select2-result"><b>{name}</b></div>',
264                                                                                             style : 'margin-top:20px;',
265                                                                                             multiple: true,
266                                                                                             listeners : {
267                                                                                                 render : function (_self) {
268                                                                                                     _this.multipleSel = _self;
269                                                                                                 }
270                                                                                             },
271                                                                                             forceSelection : true,
272                                                                                             valueField : 'id',
273                                                                                             queryParam : 'query[name]',
274                                                                                             editable : true,
275                                                                                             alwaysQuery : true,
276                                                                                             allowBlank : false,
277                                                                                             fieldLabel : 'Country Multiple',
278                                                                                             store : {
279                                                                                                 xtype: 'Store',
280                                                                                                 xns: Roo.data,
281                                                                                                 listeners : {
282                                                                                                     beforeload : function (_self, o) {
283                                                                                                         o.params = o.params || {};
284
285                                                                                                     }
286                                                                                                 },
287                                                                                                 remoteSort : true,
288                                                                                                 sortInfo : { direction : 'ASC', field: 'name' },
289                                                                                                 proxy : {
290                                                                                                     xtype: 'HttpProxy',
291                                                                                                     xns: Roo.data,
292                                                                                                     url : baseURL + '/Geoip/Core_geoip_country',
293                                                                                                     method : 'GET'
294                                                                                                 },
295                                                                                                 reader : {
296                                                                                                     xtype: 'JsonReader',
297                                                                                                     xns: Roo.data,
298                                                                                                     fields : [
299                                                                                                         {
300                                                                                                             'name': 'id',
301                                                                                                             'type': 'int'
302                                                                                                         },
303                                                                                                         {
304                                                                                                             'name': 'code',
305                                                                                                             'type': 'string'
306                                                                                                         },
307                                                                                                         {
308                                                                                                             'name': 'name',
309                                                                                                             'type': 'string'
310                                                                                                         }
311                                                                                                     ]
312                                                                                                 }
313                                                                                             }
314                                                                                         }
315                                                                                     ]
316
317                                                                                 }
318                                                                             ]
319
320                                                                         }
321                                                                     ]
322
323                                                                 }
324                                                             ]
325
326                                                         },
327                                                         {
328                                                             tabId : '#tickable',
329                                                             xtype : 'TabPanel',
330                                                             xns : Roo.bootstrap,
331                                                             navId : '#top',
332                                                             active : false,
333                                                             items : [
334                                                                 {
335                                                                     level : 4,
336                                                                     xtype : 'Header',
337                                                                     html : 'Second TabPanel With ComboBox',
338                                                                     xns : Roo.bootstrap
339                                                                 },
340                                                                 {
341                                                                     xtype : 'Container',
342                                                                     well : 'md',
343                                                                     xns : Roo.bootstrap,
344                                                                     items : [
345                                                                         {
346                                                                             xtype : 'Row',
347                                                                             xns : Roo.bootstrap,
348                                                                             items : [
349                                                                                 {
350                                                                                     xtype: 'ComboBox',
351                                                                                     xns: Roo.bootstrap,
352                                                                                     placeholder : 'Select a country',
353                                                                                     displayField : 'name',
354                                                                                     hiddenName : 'country_id',
355                                                                                     md : '12',
356                                                                                     size : 'sm',
357                                                                                     name : 'country_id_name',
358                                                                                     triggerAction : 'all',
359                                                                                     minChars : '1',
360                                                                 //                    tpl : '<li class="select2-result"><b>{name}</b></div>',
361                                                                                     style : 'margin-top:20px;',
362                                                                                     multiple: true,
363                                                                                     tickable: true,
364                                                                                     listeners : {
365                                                                                         render : function (_self) {
366                                                                                             _this.tickableSel = _self;
367                                                                                         }
368                                                                                     },
369                                                                                     forceSelection : true,
370                                                                                     valueField : 'id',
371                                                                                     queryParam : 'query[name]',
372                                                                                     editable : true,
373                                                                                     alwaysQuery : true,
374                                                                                     allowBlank : false,
375                                                                                     fieldLabel : 'Country With Tickable',
376                                                                                     store : {
377                                                                                         xtype: 'Store',
378                                                                                         xns: Roo.data,
379                                                                                         listeners : {
380                                                                                             beforeload : function (_self, o) {
381                                                                                                 o.params = o.params || {};
382
383                                                                                             }
384                                                                                         },
385                                                                                         remoteSort : true,
386                                                                                         sortInfo : { direction : 'ASC', field: 'name' },
387                                                                                         proxy : {
388                                                                                             xtype: 'HttpProxy',
389                                                                                             xns: Roo.data,
390                                                                                             url : baseURL + '/Geoip/Core_geoip_country',
391                                                                                             method : 'GET'
392                                                                                         },
393                                                                                         reader : {
394                                                                                             xtype: 'JsonReader',
395                                                                                             xns: Roo.data,
396                                                                                             fields : [
397                                                                                                 {
398                                                                                                     'name': 'id',
399                                                                                                     'type': 'int'
400                                                                                                 },
401                                                                                                 {
402                                                                                                     'name': 'code',
403                                                                                                     'type': 'string'
404                                                                                                 },
405                                                                                                 {
406                                                                                                     'name': 'name',
407                                                                                                     'type': 'string'
408                                                                                                 }
409                                                                                             ]
410                                                                                         }
411                                                                                     }
412                                                                                 }
413                                                                             ]
414
415                                                                         }
416                                                                     ]
417
418                                                                 }
419                                                             ]
420
421                                                         }
422                                                     ]
423
424                                                 }
425                                             ]
426
427                                         }
428                                     ]
429
430                                 }
431                             ]
432
433                         }
434                     ]
435
436                 }
437             ]
438         };
439     }
440 });