X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/2e847cf21b8ab9d15fa167b315ca5b2fa92638fc..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/examples/toolbar/overflow.js
diff --git a/examples/toolbar/overflow.js b/examples/toolbar/overflow.js
index 032a1c13..0095f14c 100644
--- a/examples/toolbar/overflow.js
+++ b/examples/toolbar/overflow.js
@@ -1,56 +1,60 @@
-/*!
- * Ext JS Library 3.1.1
- * Copyright(c) 2006-2010 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-Ext.onReady(function(){
-
- var handleAction = function(action){
- Ext.example.msg('Action', 'You clicked "'+action+'"');
- };
-
- var p = new Ext.Window({
- title: 'Standard',
- closable: false,
- height:250,
- width: 500,
- bodyStyle: 'padding:10px',
- contentEl: 'content',
- autoScroll: true,
- tbar: new Ext.Toolbar({
- enableOverflow: true,
- items: [{
- xtype:'splitbutton',
- text: 'Menu Button',
- iconCls: 'add16',
- handler: handleAction.createCallback('Menu Button'),
- menu: [{text: 'Menu Item 1', handler: handleAction.createCallback('Menu Item 1')}]
- },'-',{
- xtype:'splitbutton',
- text: 'Cut',
- iconCls: 'add16',
- handler: handleAction.createCallback('Cut'),
- menu: [{text: 'Cut menu', handler: handleAction.createCallback('Cut menu')}]
- },{
- text: 'Copy',
- iconCls: 'add16',
- handler: handleAction.createCallback('Copy')
- },{
- text: 'Paste',
- iconCls: 'add16',
- menu: [{text: 'Paste menu', handler: handleAction.createCallback('Paste menu')}]
- },'-',{
- text: 'Format',
- iconCls: 'add16',
- handler: handleAction.createCallback('Format')
- },'->',{
- text: 'Right',
- iconCls: 'add16',
- handler: handleAction.createCallback('Right')
- }]
- })
- });
- p.show();
-
-});
\ No newline at end of file
+Ext.require(['*']);
+Ext.onReady(function(){
+
+ var handleAction = function(action){
+ Ext.example.msg('Action', 'You clicked "' + action + '"');
+ };
+
+ var colorMenu = Ext.create('Ext.menu.ColorPicker', {
+ handler: function(cm, color){
+ Ext.example.msg('Color Selected', 'You choose {0}.', color);
+ }
+ });
+
+ Ext.create('Ext.Window', {
+ title: 'Standard',
+ closable: false,
+ height:250,
+ width: 500,
+ bodyStyle: 'padding:10px',
+ contentEl: 'content',
+ autoScroll: true,
+ tbar: Ext.create('Ext.toolbar.Toolbar', {
+ layout: {
+ overflowHandler: 'Menu'
+ },
+ items: [{
+ xtype:'splitbutton',
+ text: 'Menu Button',
+ iconCls: 'add16',
+ handler: Ext.Function.pass(handleAction, 'Menu Button'),
+ menu: [{text: 'Menu Item 1', handler: Ext.Function.pass(handleAction, 'Menu Item 1')}]
+ },'-',{
+ xtype:'splitbutton',
+ text: 'Cut',
+ iconCls: 'add16',
+ handler: Ext.Function.pass(handleAction, 'Cut'),
+ menu: [{text: 'Cut menu', handler: Ext.Function.pass(handleAction, 'Cut menu')}]
+ },{
+ text: 'Copy',
+ iconCls: 'add16',
+ handler: Ext.Function.pass(handleAction, 'Copy')
+ },{
+ text: 'Paste',
+ iconCls: 'add16',
+ menu: [{text: 'Paste menu', handler: Ext.Function.pass(handleAction, 'Paste menu')}]
+ },'-',{
+ text: 'Format',
+ iconCls: 'add16',
+ handler: Ext.Function.pass(handleAction, 'Format')
+ },'->',{
+ text: 'Right',
+ iconCls: 'add16',
+ handler: Ext.Function.pass(handleAction, 'Right')
+ }, {
+ text: 'Choose a Color',
+ menu: colorMenu // <-- submenu by reference
+ }]
+ })
+ }).show();
+});