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.
20 'Ext.container.Viewport',
31 Ext.onReady(function() {
48 html : 'Some content',
63 title: 'Masked Panel',
66 html : 'Some content',
72 p.body.mask('Loading...');
89 title: 'Framed Panel',
112 html : 'Some content',
120 Ext.createWidget('window', {
130 html : 'Click Submit for Confirmation Msg.',
145 handler: function() {
146 Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?');
153 * Toolbar with a menu
155 var menu = Ext.createWidget('menu', {
158 {text: 'Check 1', checked: true},
159 {text: 'Check 2', checked: false},
161 {text: 'Option 1', checked: true, group: 'opts'},
162 {text: 'Option 2', checked: false, group: 'opts'},
166 menu: Ext.createWidget('menu', {
184 title: 'Basic Panel With Toolbars',
187 'Toolbar & Menus',
197 xtype: 'splitbutton',
198 text : 'Split Button',
199 menu : Ext.createWidget('menu', {
210 text : 'Toggle Button'
219 * Form and form widgets
225 title: 'Form Widgets',
255 bodyPadding: '10 20',
269 fieldLabel: 'TextField',
272 emptyText : 'Enter a value'
275 fieldLabel: 'ComboBox',
277 store: ['Foo', 'Bar']
280 fieldLabel: 'DateField',
285 fieldLabel: 'TimeField',
290 fieldLabel: 'NumberField',
291 xtype : 'numberfield',
293 emptyText : '(This field is optional)',
297 fieldLabel: 'TextArea',
298 xtype : 'textareafield',
300 cls : 'x-form-valid',
301 value : 'This field is hard-coded to have the "valid" style (it will require some code changes to add/remove this style dynamically)'
304 fieldLabel: 'Checkboxes',
305 xtype: 'checkboxgroup',
307 items: [{boxLabel: 'Foo', checked: true},{boxLabel: 'Bar'}]
310 fieldLabel: 'Radios',
313 items: [{boxLabel: 'Foo', checked: true, name: 'radios'},{boxLabel: 'Bar', name: 'radios'}]
318 xtype : 'htmleditor',
321 value : 'Mouse over toolbar for tooltips.<br /><br />The HTMLEditor IFrame requires a refresh between a stylesheet switch to get accurate colors.',
326 title : 'Plain Fieldset'
330 title : 'Collapsible Fieldset',
335 title : 'Checkbox Fieldset',
342 text :'Toggle Enabled',
343 handler: function() {
344 this.up('form').items.each(function(item) {
345 item.setDisabled(!item.disabled);
351 handler: function() {
352 Ext.getCmp('form-widgets').getForm().reset();
357 handler: function() {
358 Ext.getCmp('form-widgets').getForm().isValid();
375 title : 'BorderLayout Panel',
396 collapseMode: 'mini',
404 collapseMode: 'mini',
428 ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
429 ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
430 ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
431 ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
432 ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
433 ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
434 ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
435 ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
436 ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
437 ['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am']
440 var store = Ext.create('Ext.data.ArrayStore', {
443 {name: 'price', type: 'float'},
444 {name: 'change', type: 'float'},
445 {name: 'pctChange', type: 'float'},
446 {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
449 property : 'company',
456 var pagingBar = Ext.createWidget('pagingtoolbar', {
459 displayMsg : 'Displaying topics {0} - {1} of {2}'
475 {header: "Company", flex: 1, sortable: true, dataIndex: 'company'},
476 {header: "Price", width: 75, sortable: true, dataIndex: 'price'},
477 {header: "Change", width: 75, sortable: true, dataIndex: 'change'},
478 {header: "% Change", width: 75, sortable: true, dataIndex: 'pctChange'},
479 {header: "Last Updated", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
492 xtype: 'triggerfield',
493 trigger1Cls: Ext.baseCSSPrefix + 'form-clear-trigger',
494 trigger2Cls: Ext.baseCSSPrefix + 'form-search-trigger'
499 //=============================================================
501 //=============================================================
502 var tree = Ext.create('Ext.tree.Panel', {
524 title : 'Accordion and TreePanel',
533 'background-color': '#eee'
542 html : 'Some content'
547 items.push(accConfig);
561 bodyStyle: 'padding:10px;'
567 html : 'Free-standing tab panel'
580 items.push(Ext.applyIf({
583 enableTabScroll: true,
588 html : 'Tab panel for display in a border layout'
613 items.push(Ext.apply({
634 //=============================================================
636 //=============================================================
637 var rszEl = Ext.getBody().createChild({
638 style: 'background: transparent;',
639 html: '<div style="padding:20px;">Resizable handles</div>'
642 rszEl.position('absolute', 1, 240, 1130);
643 rszEl.setSize(180, 180);
644 Ext.create('Ext.resizer.Resizer', {
651 * ProgressBar / Slider
653 var progressbar = Ext.createWidget('progressbar', {
659 title: 'ProgressBar / Slider',
696 title: 'Framed Grid',
699 emptyText: 'No images to display',
701 enableColumnMove: false,
703 {header: "Company", flex: 1, sortable: true, dataIndex: 'company'},
704 {header: "Price", width: 75, sortable: true, dataIndex: 'price'},
705 {header: "Change", width: 75, sortable: true, dataIndex: 'change'}
709 for (var i = 0; i < items.length; i++) {
713 var item = Ext.ComponentManager.create(items[i], 'panel');
714 item.render(document.body);
717 setTimeout(function() {
718 Ext.QuickTips.init();
720 text: 'Progress text...'
725 * Stylesheet Switcher
727 Ext.get('styleswitcher_select').on('change', function(e, select) {
728 var name = select[select.selectedIndex].value,
729 currentPath = window.location.pathname,
730 isCurrent = currentPath.match(name);
733 window.location = name;