extjs中treepanel和tabpanel结合实现布局

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutPage1.cshtml";
}

@section Script{

    <script>


        Ext.onReady(panelLayout);
        function panelLayout() {
            //新建tabpanel
            var tab = Ext.create('Ext.TabPanel', {
                region: 'center',
                deferredRender: false,
                activeTab: 0,
                resizeTabs: true, // turn on tab resizing
                minTabWidth: 115,
                tabWidth: 135,
                enableTabScroll: true
            });
            var viewPort = Ext.create('Ext.Viewport', {
                layout: "border",
                items: [{
                    region: 'north',
                    minHeight: 100,
                    html: 'north'
                }, {

                    region: 'west',
                    xtype: 'panel',
                    width: 200,
                    collapsible: true, // 设置可折叠
                    id: 'west-region-container',
                    layout: 'fit',
                    margins: '0 0 0 0',
                    layout: 'accordion',
                    title: '菜单',
                    split: true,
                    collapsible: true,
                    layoutConfig: {
                        animate: true
                    },
                    items: [{
                        title: '业务信息处理',
                        xtype: 'treepanel',
                        expanded: true,
                        animate: true,
                        enableDD: false,
                        border: false,
                        containerScroll: true,
                        root: {
                            text: '..',
                            id: 'root',
                            leaf:false,
                            children: [{
                                text: '业务信息',

                                leaf: false,
                                children: [{
                                    text: '组织管理',
                                    leaf: true,
                                    id: 'dept_list1.jsp'


                                }]
                            }, {
                                text: '组织管理',
                                leaf: true,
                                id: 'dept_list.jsp'
                            }]
                        }, listeners: {
                            //添加节点点击事件
                            itemclick: function (v, r, item) {
                                var n = tab.getComponent(r.raw.id);

                                alert(r.raw.leaf);//获取当前点击树节点的是否是子节点 (leaf=false)
                                alert(r.raw.id);
                                if (r.raw.leaf == false) {
                                    return;
                                }
                                if (!n) { // 判断是否已经打开该面板
                                    n = tab.add({
                                        'id': r.raw.id,
                                        'title': r.raw.text,
                                        closable: true, // 通过html载入目标页
                                        html: '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + r.raw.id + '"></iframe>'
                                    });
                                }
                                tab.setActiveTab(n);
                            }
                        }

                    }, {
                        title: '信息中心',
                        border: false,
                        html: '<div id="tree2" style="overflow:auto;width:100%;height:100%"></div>'
                    }, {
                        title: '系统设置',
                        border: false,
                        html: '<div id="tree3" style="overflow:auto;width:100%;height:100%"></div>'
                    },



                    ]
                }, tab, {
                    region: 'south',
                    minHeight: 25,
                    html: "<div align='center'>版权所有 xxxx有限公司 © 信息服务中心</div>"
                }]
            })

        }

    </script>
};

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值