ExtJS 4 【Ext.menu.Menu】

來源:互聯網
上載者:User

標籤:display   開啟   pad   title   arp   ima   read   als   技術分享   

<div id="toolbar"></div>
 
Ext.onReady(function () {    var toolbar = new Ext.toolbar.Toolbar({        renderTo: ‘toolbar‘    });    var fileMenu = new Ext.menu.Menu({        shadow: ‘frame‘,        allowOtherMenus: true,        items: [            new Ext.menu.Item(                { text: ‘建立‘, handler: onMenuItem }),            { text: ‘開啟‘, handler: onMenuItem },            { text: ‘關閉‘, handler: onMenuItem }        ]    });    var editMenu = new Ext.menu.Menu({        shadow: ‘drop‘,        allowOtherMenus: true,        items: [            { text: ‘複製‘, handler: onMenuItem },            { text: ‘粘貼‘, handler: onMenuItem },            { text: ‘剪下‘, handler: onMenuItem }        ]    });    toolbar.add(        { text: ‘檔案‘, menu: fileMenu },        { text: ‘編輯‘, menu: editMenu }    );    function onMenuItem(item) {        alert(item.text);    }});
 

 
<div id="toolbar"></div>
 
Ext.onReady(function () {    var toolbar = new Ext.toolbar.Toolbar({        renderTo: ‘toolbar‘    });    …    var userMenu = new Ext.menu.Menu({        ignoreParentClicks: true,        plain: true,        items: [        {            text: ‘個人資訊‘,            menu: new Ext.menu.Menu({                ignoreParentClicks: true,                items: [                {                    text: ‘基本資料‘,                    menu: new Ext.menu.Menu({                        items: [                            { text: ‘身高‘, handler: onMenuItem },                            { text: ‘體重‘, handler: onMenuItem }                        ]                    })                }]            })        }]    });    toolbar.add(        { text: ‘檔案‘, menu: fileMenu },        { text: ‘編輯‘, menu: editMenu },        { text: ‘使用者‘, menu: userMenu }    );    function onMenuItem(item) {        alert(item.text);    }});

 
 
<div id="toolbar"></div>
 
Ext.onReady(function () {    var toolbar = new Ext.toolbar.Toolbar({        renderTo: ‘toolbar‘    });
…    var menu1 = new Ext.menu.Menu({        items: [        {            xtype: ‘textfield‘,            hideLabel: true,            width: 100        }, {            text: ‘顏色選擇‘,            menu: new Ext.menu.ColorPicker()        }, {            xtype: ‘datepicker‘        }, {            xtype: ‘buttongroup‘,            columns: 3,            title: ‘按鈕組‘,            items: [            {                text: ‘使用者管理‘,                scale: ‘large‘,                colspan: 3,                width: 170            }, {                text: ‘建立‘            }, {                text: ‘開啟‘            }, {                text: ‘儲存‘            }]        }        ]    });    toolbar.add(        { text: ‘檔案‘, menu: fileMenu },        { text: ‘編輯‘, menu: editMenu },        { text: ‘使用者‘, menu: userMenu },        { text: ‘組‘, menu: menu1 }    );    function onMenuItem(item) {        alert(item.text);    }});
 
 
Ext.onReady(function () {    var toolbar = new Ext.toolbar.Toolbar({        renderTo: ‘toolbar‘    });   …    var menu2 = new Ext.menu.Menu({        items: [        {            text: ‘佈景主題色彩‘,            menu: new Ext.menu.Menu({                items: [                {                    text: ‘紅色主題‘,                    checked: true,                    group: ‘theme‘,                    checkHandler: onItemCheck                }, {                    text: ‘藍色主題‘,                    checked: false,                    group: ‘theme‘,                    checkHandler: onItemCheck                }]            })        }, {            text: ‘是否啟用‘,            checked: false        }]    });    toolbar.add(        { text: ‘檔案‘, menu: fileMenu },        { text: ‘編輯‘, menu: editMenu },        { text: ‘使用者‘, menu: userMenu },        { text: ‘組‘, menu: menu1 },        { text: ‘選項‘, menu: menu2 }    );    function onMenuItem(item) {        alert(item.text);    }    function onItemCheck(item) {        alert(item.text);    }});
 
 

 
 
 
 
 
 
 
 
 

ExtJS 4 【Ext.menu.Menu】

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.