3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
15 Ext.Loader.setConfig({enabled: true});
17 Ext.Loader.setPath('Ext.ux', '../ux/');
21 'Ext.tip.QuickTipManager',
23 'Ext.ux.data.PagingMemoryProxy',
27 Ext.onReady(function(){
28 MultiLangDemo = (function() {
29 // get the selected language code parameter from url (if exists)
30 var params = Ext.urlDecode(window.location.search.substring(1));
31 //Ext.form.Field.prototype.msgTarget = 'side';
35 Ext.tip.QuickTipManager.init();
37 /* Language chooser combobox */
38 var store = Ext.create('Ext.data.ArrayStore', {
39 fields: ['code', 'language', 'charset'],
40 data : Ext.exampledata.languages // from languages.js
43 var combo = Ext.create('Ext.form.field.ComboBox', {
44 renderTo: 'languages',
46 displayField:'language',
48 emptyText: 'Select a language...',
52 fn: function(cb, records) {
53 var record = records[0];
54 window.location.search = Ext.urlEncode({"lang":record.get("code"),"charset":record.get("charset")});
62 // check if there's really a language with that language code
63 var record = store.findRecord('code', params.lang, null, null, null, true);
64 // if language was found in store assign it as current value in combobox
66 combo.setValue(record.data.language);
71 var url = Ext.util.Format.format("../../locale/ext-lang-{0}.js", params.lang);
75 success: this.onSuccess,
76 failure: this.onFailure,
83 onSuccess: function(response, opts) {
84 eval(response.responseText);
87 onFailure: function() {
88 Ext.Msg.alert('Failure', 'Failed to load locale file.');
91 setupDemo: function() {
93 Ext.create('Ext.FormPanel', {
94 renderTo: 'emailfield',
95 labelWidth: 100, // label settings here cascade unless overridden
98 bodyStyle: 'padding:5px 5px 0',
104 defaultType: 'textfield',
113 Ext.create('Ext.FormPanel', {
114 renderTo: 'datefield',
115 labelWidth: 100, // label settings here cascade unless overridden
118 bodyStyle: 'padding:5px 5px 0',
124 defaultType: 'datefield',
132 var monthArray = Ext.Array.map(Ext.Date.monthNames, function (e) { return [e]; });
133 var ds = Ext.create('Ext.data.Store', {
138 type: 'pagingmemory',
146 Ext.create('Ext.grid.Panel', {
150 title:'Month Browser',
152 text: 'Month of the year',
157 bbar: Ext.create('Ext.toolbar.Paging', {
164 // trigger the data store load
170 MultiLangDemo.init();