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 : 1,
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 : 2,
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 : '#th',
98                                                                     xtype : 'NavItem',
99                                                                     preventDefault : true,
100                                                                     html : 2,
101                                                                     xns : Roo.bootstrap,
102                                                                     active : false,
103                                                                     listeners : {
104                                                                         render : function (_self)
105                                                                            {
106                                                                               _this.two = 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 : '#one',
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 //                                                                                            multiple: true,
165                                                                                             listeners : {
166                                                                                                 render : function (_self) {
167                                                                                                     _this.normalSel = _self;
168                                                                                                 }
169                                                                                             },
170                                                                                             forceSelection : true,
171                                                                                             valueField : 'id',
172                                                                                             queryParam : 'query[name]',
173                                                                                             editable : true,
174                                                                                             alwaysQuery : true,
175                                                                                             allowBlank : false,
176                                                                                             fieldLabel : 'Country Normal',
177                                                                                             store : {
178                                                                                                 xtype: 'Store',
179                                                                                                 xns: Roo.data,
180                                                                                                 listeners : {
181                                                                                                     beforeload : function (_self, o) {
182                                                                                                         o.params = o.params || {};
183
184                                                                                                     }
185                                                                                                 },
186                                                                                                 remoteSort : true,
187                                                                                                 sortInfo : { direction : 'ASC', field: 'name' },
188                                                                                                 proxy : {
189                                                                                                     xtype: 'HttpProxy',
190                                                                                                     xns: Roo.data,
191                                                                                                     url : baseURL + '/Geoip/Core_geoip_country',
192                                                                                                     method : 'GET'
193                                                                                                 },
194                                                                                                 reader : {
195                                                                                                     xtype: 'JsonReader',
196                                                                                                     xns: Roo.data,
197                                                                                                     fields : [
198                                                                                                         {
199                                                                                                             'name': 'id',
200                                                                                                             'type': 'int'
201                                                                                                         },
202                                                                                                         {
203                                                                                                             'name': 'code',
204                                                                                                             'type': 'string'
205                                                                                                         },
206                                                                                                         {
207                                                                                                             'name': 'name',
208                                                                                                             'type': 'string'
209                                                                                                         }
210                                                                                                     ]
211                                                                                                 }
212                                                                                             }
213                                                                                         }
214                                                                                     ]
215
216                                                                                 }
217                                                                             ]
218
219                                                                         }
220                                                                     ]
221
222                                                                 }
223                                                             ]
224
225                                                         },
226                                                         {
227                                                             tabId : '#two',
228                                                             xtype : 'TabPanel',
229                                                             xns : Roo.bootstrap,
230                                                             navId : '#top',
231                                                             active : false,
232                                                             items : [
233                                                                 {
234                                                                     level : 4,
235                                                                     xtype : 'Header',
236                                                                     html : 'Second TabPanel With ComboBox',
237                                                                     xns : Roo.bootstrap
238                                                                 },
239                                                                 {
240                                                                     xtype : 'Container',
241                                                                     well : 'md',
242                                                                     xns : Roo.bootstrap,
243                                                                     items : [
244                                                                         {
245                                                                             xtype : 'Row',
246                                                                             xns : Roo.bootstrap,
247                                                                             items : [
248                                                                                 {
249                                                                                     xtype: 'ComboBox',
250                                                                                     xns: Roo.bootstrap,
251                                                                                     placeholder : 'Select a country',
252                                                                                     displayField : 'name',
253                                                                                     hiddenName : 'country_id',
254                                                                                     md : '12',
255                                                                                     size : 'sm',
256                                                                                     name : 'country_id_name',
257                                                                                     triggerAction : 'all',
258                                                                                     minChars : '1',
259                                                                 //                    tpl : '<li class="select2-result"><b>{name}</b></div>',
260                                                                                     style : 'margin-top:20px;',
261                                                                                     multiple: true,
262                                                                                     tickable: true,
263                                                                                     listeners : {
264                                                                                         render : function (_self) {
265                                                                                             _this.tickableSel = _self;
266                                                                                         }
267                                                                                     },
268                                                                                     forceSelection : true,
269                                                                                     valueField : 'id',
270                                                                                     queryParam : 'query[name]',
271                                                                                     editable : true,
272                                                                                     alwaysQuery : true,
273                                                                                     allowBlank : false,
274                                                                                     fieldLabel : 'Country With Tickable',
275                                                                 //                    pageSize : '10',
276                                                                 //                    append: true,
277                                                                                     store : {
278                                                                                         xtype: 'Store',
279                                                                                         xns: Roo.data,
280                                                                                         listeners : {
281                                                                                             beforeload : function (_self, o) {
282                                                                                                 o.params = o.params || {};
283
284                                                                                             }
285                                                                                         },
286                                                                                         remoteSort : true,
287                                                                                         sortInfo : { direction : 'ASC', field: 'name' },
288                                                                                         proxy : {
289                                                                                             xtype: 'HttpProxy',
290                                                                                             xns: Roo.data,
291                                                                                             url : baseURL + '/Geoip/Core_geoip_country',
292                                                                                             method : 'GET'
293                                                                                         },
294                                                                                         reader : {
295                                                                                             xtype: 'JsonReader',
296                                                                                             xns: Roo.data,
297                                                                                             fields : [
298                                                                                                 {
299                                                                                                     'name': 'id',
300                                                                                                     'type': 'int'
301                                                                                                 },
302                                                                                                 {
303                                                                                                     'name': 'code',
304                                                                                                     'type': 'string'
305                                                                                                 },
306                                                                                                 {
307                                                                                                     'name': 'name',
308                                                                                                     'type': 'string'
309                                                                                                 }
310                                                                                             ]
311                                                                                         }
312                                                                                     }
313                                                                                 }
314                                                                             ]
315
316                                                                         }
317                                                                     ]
318
319                                                                 }
320                                                             ]
321
322                                                         }
323                                                     ]
324
325                                                 }
326                                             ]
327
328                                         }
329                                     ]
330
331                                 }
332                             ]
333
334                         }
335                     ]
336
337                 }
338             ]
339         };
340     }
341 });