码迷,mamicode.com
首页 > Web开发 > 详细

extjs desktop startmenu (开始菜单)

时间:2015-03-16 17:51:26      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:extjs4.2   javascript   开始菜单   

extjs desktop 的开始菜单 二级菜单,只是简单演示实现原理,如 需要动态生成,自己改造即可,以下基本方法原理:


首先 建立一个js文件 生成开始菜单数据:


?

function GetStartMenu(app) {
    var menuArray = [];

    var m = {
        launcher: {
            text: ‘开始菜单第一级A‘,
            iconCls: ‘icon-grid‘,
            handler: function() {
                return false;
            },
            menu: {
                minWidth: 127,
                items: []
            }
        }
    };

    m.launcher.menu.items.push({
        winId: ‘menua01‘,
        winUrl: ‘abc/abcd.html‘,
        text: ‘开始菜单第二级A01‘,
        maximized: false,
        iconCls: ‘icon-grid‘,
        scope: this,
        handler: function(src) {
             var desktop = app.getDesktop();
            var win = desktop.getWindow(‘menua01‘);
            if (!win) {
                win = desktop.createWindow({
                    border: false,
                    id: ‘menua01‘,
                    title: ‘开始菜单第级A01‘,
                    width: 600,
                    height: 500,
                    maximized: true,
                    maximizable: true,
                    resizable: true,
                    iconCls: ‘icon-grid‘,
                    hideMode: ‘offsets‘,
                    constrain: true,
                    layout: ‘fit‘,
                    loader: {
                        url: ‘abc/abcd.html‘,
                        autoLoad: true,
                        scripts: true
                    }
                });
            }
            win.show();
            return win;
        }
    });


    m.launcher.menu.items.push({
        winId: ‘menua02‘,
        winUrl: ‘abc/bbbb.html‘,
        text: ‘开始菜单第级A02‘,
        maximized: false,
        iconCls: ‘icon-grid‘,
        scope: this,
        handler: function(src) {
            var desktop = app.getDesktop();
            var win = desktop.getWindow(‘menua02‘);
            if (!win) {
                win = desktop.createWindow({
                    border: false,
                    id: ‘menua02‘,
                    title: ‘开始菜单第级A02‘,
                    width: 800,
                    height: 600,
                    maximized: false,
                    maximizable: true,
                    resizable: false,
                    iconCls: ‘icon-grid‘,
                    hideMode: ‘offsets‘,
                    constrain: true,
                    layout: ‘fit‘,
                    loader: {
                        url: ‘abc/bbbb.html‘,
                        autoLoad: true,
                        scripts: true
                    }
                });
            }
            win.show();
            return win;
        }
    });

    menuArray.push(m);

    return menuArray;
}

在主页面引入该文件 然后修改app.js,找到 getModules: function () {  删除里面内容 改为:

   getModules: function () {
           return GetStartMenu(this);
    },

即可实现开始菜单的二级菜单



extjs desktop startmenu (开始菜单)

标签:extjs4.2   javascript   开始菜单   

原文地址:http://blog.csdn.net/olinbsoft/article/details/44308135

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!