当前位置: 首页 > news >正文

初学者比较容易犯的布局错误(手风琴布局)


从上图面板中那条横线可以很清楚的看出树面板的容器没有使用Fit布局造成了树面板没有填满整个布局,而是根据自身大小进行显示。


实际的代码:

var mainAccirdion = new Ext.Panel({
        id: "MainAccirdion",
        region: 'west',
        split: true,
        layout: 'accordion',
        collapsible: true,
        width: 200,
        layoutConfig: {
            titleCollapse: false,
            animate: true,
            activeOnTop: true
        },
        items: [{
            title: '病人报告列表',
            items: [{ items: treepanel, flex: 1, layout: 'fit' }]
        }
        ]
    })


代码中,首先存在的问题是,使用了不必要的嵌套布局,其实这个在第一层直接使用treepanel就可以了,没必要再套容器。由于套多了一层布局,就造成了虽然在下一层布局使用了Fit布局,但是还是不能填满顶层容器。

在我的书《Ext JS权威指南》的9.8.2节中有一个示例可供参考,代码如下:

Ext.create("Ext.Viewport",{
    layout:{type:"border",padding:5},
    items:[
        //区域定义
        {xtype:"container",region:"north",height:30,
            html:"<h1>示例9-5 单页面应用中使用Card实现“页面”切换</h1>"
        },
        {region:"west",split:true,width:200,minWidth:100,
            layout:"accordion",
            items:[
                {title:"产品管理",xtype:"treepanel",
                    rootVisible: false,
                    root: {
                        text: 'root',id: 'rootProduct',
                        expanded: true,children:[
                            {text:"产品管理",id:"Product",leaf:true},
                            {text:"统计管理",id:"Stat",leaf:true}
                        ]
                    },
                    listeners:{itemclick:itemclick}
                },
                {title:"系统管理",xtype:"treepanel",
                    rootVisible: false,
                    root: {
                        text: 'root',id: 'rootSyetem',
                        expanded: true,children:[
                            {text:"用户管理",id:"User",leaf:true},
                            {text:"系统设置",id:"System",leaf:true}
                        ]
                    },
                    listeners:{itemclick:itemclick}
                }
            ]
        },
        {region:"center",layout:'card',border:false,
            id:"ContentPage",loader:true,
            items:[
                {title:"产品管理",id:"ProductContent",tbar:[
                    {text:"增加"},{text:"编辑"},{text:"删除"}
                ]}
            ],
            listeners:{
                add:function(cmp,con,pos){
                    if(this.items.length>1){
                        this.getLayout().setActiveItem(pos);
                    }
                }
            }
        }
    ]
})

转载于:https://www.cnblogs.com/hainange/archive/2013/04/07/6334205.html

相关文章:

  • Linux操作系统加固
  • 对 preferred-value 的理解
  • CMB面试准备-基础
  • 添加到web.config文件里的用户自定义翻页控件
  • [置顶] Web开发工具
  • php实现 称砝码(背包)
  • Debian samba支持域用户登录
  • Centos7命令行下安装和配置Apache服务器
  • linux命令截取文件最后n行(所有命令)
  • python-模块与包
  • Java进阶02 异常处理
  • Kerberos+LDAP+NFSv4 实现单点登录
  • mysql 常用函数
  • SystemCenter2012SP1实践(5)SCVMM管理HyperV
  • 王永庆:技术创新改变教育未来
  • Angular6错误 Service: No provider for Renderer2
  • Invalidate和postInvalidate的区别
  • Leetcode 27 Remove Element
  • linux学习笔记
  • React-redux的原理以及使用
  • 从零开始学习部署
  • 关于字符编码你应该知道的事情
  • 基于web的全景—— Pannellum小试
  • 腾讯优测优分享 | Android碎片化问题小结——关于闪光灯的那些事儿
  • 小程序开发中的那些坑
  • 大数据全解:定义、价值及挑战
  • #Linux杂记--将Python3的源码编译为.so文件方法与Linux环境下的交叉编译方法
  • (delphi11最新学习资料) Object Pascal 学习笔记---第2章第五节(日期和时间)
  • (poj1.2.1)1970(筛选法模拟)
  • (大众金融)SQL server面试题(1)-总销售量最少的3个型号的车及其总销售量
  • (二)正点原子I.MX6ULL u-boot移植
  • (附源码)ssm码农论坛 毕业设计 231126
  • (译) 函数式 JS #1:简介
  • (转)mysql使用Navicat 导出和导入数据库
  • (转)拼包函数及网络封包的异常处理(含代码)
  • **Java有哪些悲观锁的实现_乐观锁、悲观锁、Redis分布式锁和Zookeeper分布式锁的实现以及流程原理...
  • .net 7 上传文件踩坑
  • .Net Framework 4.x 程序到底运行在哪个 CLR 版本之上
  • .NET MVC 验证码
  • .net wcf memory gates checking failed
  • .net 写了一个支持重试、熔断和超时策略的 HttpClient 实例池
  • .NET简谈设计模式之(单件模式)
  • .net经典笔试题
  • .NET上SQLite的连接
  • ::前边啥也没有
  • @angular/cli项目构建--http(2)
  • [ C++ ] 继承
  • [ vulhub漏洞复现篇 ] Jetty WEB-INF 文件读取复现CVE-2021-34429
  • [51nod1610]路径计数
  • [8481302]博弈论 斯坦福game theory stanford week 1
  • [AIGC] Java 和 Kotlin 的区别
  • [Android Pro] android 混淆文件project.properties和proguard-project.txt
  • [Android]创建TabBar
  • [Angular 基础] - 表单:响应式表单
  • [AutoSar NVM] 存储架构