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 : '#one',
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.one = this;
77                                                                               
78                                                                            }
79                                                                     }
80                                                                 },
81                                                                 {
82                                                                     tabId : '#two',
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.two = this;
92                                                                               
93                                                                            }
94                                                                     }
95                                                                 }
96                                                             ]
97
98                                                         }
99                                                     ]
100
101                                                 },
102                                                 {
103                                                     xtype : 'TabGroup',
104                                                     style : 'margin-top:20px;',
105                                                     xns : Roo.bootstrap,
106                                                     navId : '#top',
107                                                     carousel : true,
108                                                     items : [
109                                                         {
110                                                             tabId : '#one',
111                                                             xtype : 'TabPanel',
112                                                             xns : Roo.bootstrap,
113                                                             navId : '#top',
114                                                             active : true,
115                                                             items : [
116                                                                 {
117                                                                     level : 4,
118                                                                     xtype : 'Header',
119                                                                     html : 'First TabPanel With ComboBox',
120                                                                     xns : Roo.bootstrap
121                                                                 },
122                                                                 {
123                                                                     xtype : 'Container',
124                                                                     well : 'md',
125                                                                     xns : Roo.bootstrap,
126                                                                     items : [
127                                                                         {
128                                                                             xtype : 'Row',
129                                                                             xns : Roo.bootstrap,
130                                                                             items : [
131                                                                                 {
132                                                                                     md : 12,
133                                                                                     xtype : 'Column',
134                                                                                     xns : Roo.bootstrap,
135                                                                                     items : [
136                                                                                         {
137                                                                                             xtype: 'ComboBox',
138                                                                                             xns: Roo.bootstrap,
139                                                                                             placeholder : 'Select a country',
140                                                                                             displayField : 'name',
141                                                                                             hiddenName : 'country_id',
142                                                                                             md : '12',
143                                                                                             size : 'sm',
144                                                                                             name : 'country_id_name',
145                                                                                             triggerAction : 'all',
146                                                                                             minChars : '1',
147                                                                                             tpl : '<li class="select2-result"><b>{name}</b></div>',
148                                                                                             style : 'margin-top:20px;',
149 //                                                                                            multiple: true,
150                                                                                             listeners : {
151                                                                                                 render : function (_self) {
152                                                                                                     _this.normalSel = _self;
153                                                                                                 }
154                                                                                             },
155                                                                                             forceSelection : true,
156                                                                                             valueField : 'id',
157                                                                                             queryParam : 'query[name]',
158                                                                                             editable : true,
159                                                                                             alwaysQuery : true,
160                                                                                             allowBlank : false,
161                                                                                             fieldLabel : 'Country Normal',
162                                                                                             store : {
163                                                                                                 xtype: 'Store',
164                                                                                                 xns: Roo.data,
165                                                                                                 listeners : {
166                                                                                                     beforeload : function (_self, o) {
167                                                                                                         o.params = o.params || {};
168
169                                                                                                     }
170                                                                                                 },
171                                                                                                 remoteSort : true,
172                                                                                                 sortInfo : { direction : 'ASC', field: 'name' },
173                                                                                                 proxy : {
174                                                                                                     xtype: 'HttpProxy',
175                                                                                                     xns: Roo.data,
176                                                                                                     url : baseURL + '/Geoip/Core_geoip_country',
177                                                                                                     method : 'GET'
178                                                                                                 },
179                                                                                                 reader : {
180                                                                                                     xtype: 'JsonReader',
181                                                                                                     xns: Roo.data,
182                                                                                                     fields : [
183                                                                                                         {
184                                                                                                             'name': 'id',
185                                                                                                             'type': 'int'
186                                                                                                         },
187                                                                                                         {
188                                                                                                             'name': 'code',
189                                                                                                             'type': 'string'
190                                                                                                         },
191                                                                                                         {
192                                                                                                             'name': 'name',
193                                                                                                             'type': 'string'
194                                                                                                         }
195                                                                                                     ]
196                                                                                                 }
197                                                                                             }
198                                                                                         }
199                                                                                     ]
200
201                                                                                 }
202                                                                             ]
203
204                                                                         }
205                                                                     ]
206
207                                                                 }
208                                                             ]
209
210                                                         },
211                                                         {
212                                                             tabId : '#two',
213                                                             xtype : 'TabPanel',
214                                                             xns : Roo.bootstrap,
215                                                             navId : '#top',
216                                                             active : false,
217                                                             items : [
218                                                                 {
219                                                                     level : 4,
220                                                                     xtype : 'Header',
221                                                                     html : 'Second TabPanel With ComboBox',
222                                                                     xns : Roo.bootstrap
223                                                                 },
224                                                                 {
225                                                                     xtype : 'Container',
226                                                                     well : 'md',
227                                                                     xns : Roo.bootstrap,
228                                                                     items : [
229                                                                         {
230                                                                             xtype : 'Row',
231                                                                             xns : Roo.bootstrap,
232                                                                             items : [
233                                                                                 {
234                                                                                     xtype: 'ComboBox',
235                                                                                     xns: Roo.bootstrap,
236                                                                                     placeholder : 'Select a country',
237                                                                                     displayField : 'name',
238                                                                                     hiddenName : 'country_id',
239                                                                                     md : '12',
240                                                                                     size : 'sm',
241                                                                                     name : 'country_id_name',
242                                                                                     triggerAction : 'all',
243                                                                                     minChars : '1',
244                                                                 //                    tpl : '<li class="select2-result"><b>{name}</b></div>',
245                                                                                     style : 'margin-top:20px;',
246                                                                                     multiple: true,
247                                                                                     tickable: true,
248                                                                                     listeners : {
249                                                                                         render : function (_self) {
250                                                                                             _this.tickableSel = _self;
251                                                                                         }
252                                                                                     },
253                                                                                     forceSelection : true,
254                                                                                     valueField : 'id',
255                                                                                     queryParam : 'query[name]',
256                                                                                     editable : true,
257                                                                                     alwaysQuery : true,
258                                                                                     allowBlank : false,
259                                                                                     fieldLabel : 'Country With Tickable',
260                                                                 //                    pageSize : '10',
261                                                                 //                    append: true,
262                                                                                     store : {
263                                                                                         xtype: 'Store',
264                                                                                         xns: Roo.data,
265                                                                                         listeners : {
266                                                                                             beforeload : function (_self, o) {
267                                                                                                 o.params = o.params || {};
268
269                                                                                             }
270                                                                                         },
271                                                                                         remoteSort : true,
272                                                                                         sortInfo : { direction : 'ASC', field: 'name' },
273                                                                                         proxy : {
274                                                                                             xtype: 'HttpProxy',
275                                                                                             xns: Roo.data,
276                                                                                             url : baseURL + '/Geoip/Core_geoip_country',
277                                                                                             method : 'GET'
278                                                                                         },
279                                                                                         reader : {
280                                                                                             xtype: 'JsonReader',
281                                                                                             xns: Roo.data,
282                                                                                             fields : [
283                                                                                                 {
284                                                                                                     'name': 'id',
285                                                                                                     'type': 'int'
286                                                                                                 },
287                                                                                                 {
288                                                                                                     'name': 'code',
289                                                                                                     'type': 'string'
290                                                                                                 },
291                                                                                                 {
292                                                                                                     'name': 'name',
293                                                                                                     'type': 'string'
294                                                                                                 }
295                                                                                             ]
296                                                                                         }
297                                                                                     }
298                                                                                 }
299                                                                             ]
300
301                                                                         }
302                                                                     ]
303
304                                                                 }
305                                                             ]
306
307                                                         }
308                                                     ]
309
310                                                 }
311                                             ]
312
313                                         }
314                                     ]
315
316                                 }
317                             ]
318
319                         }
320                     ]
321
322                 }
323             ]
324         };
325     }
326 });