Extjs Column布局常见问题及解决方法
原文地址:http://blog.csdn.net/weoln/article/details/4339533
第一次用Extjs的column布局时遇见了很多问题,记录下来,供大家参考。column布局时常会碰见label不能显示或者控件显示错位等问题,导致这些问题的常见原因如下:
1.formPanel上的控件显示不出来,控件的宽度太大,formpanel的宽度相对太小导致。
2.为FormPanel设定了defaultType属性,没有为每个控件单独制定xtype属性。正确的做法是不设置defaultType。
3.在每个column里再加上form layout,再在form里加textfield。
4.在新建TabPanel时,将其属性layoutOnTabChange设置为true即可。(此方法不通用)
实例代码如下:
Ext.onReady(function(){
Ext.QuickTips.init();
// turn on validation errors beside the field globally
Ext.form.Field.prototype.msgTarget = 'side';
var bd = Ext.getBody();
var detailForm = new Ext.FormPanel({
id:"detail",
layout:"form",
labelWidth: 60,
labelAlign:"right",
border:false,
frame:true,
width: 600,//宽度设置要合理,如果FormPanel的宽度小于控件的宽度,column布局时控件不能正常显示
height:400,
// autoHeight:true,
// defaultType: 'textfield',//column布局时不能设置该属性,否则不能正常显示
items: [{//第一行
layout:"column",
items:[{
columnWidth:.3,//第一列
layout:"form",
items:[{
xtype:"textfield",
fieldLabel: '合同编号',
name: 'contractId',
width:100
}]
},{
columnWidth:.3,//第二列
layout:"form",
items:[{
xtype:"textfield",
fieldLabel: '合同名称',
name: 'contractId1',
width:100
}]
},{
columnWidth:.3,//第三列
layout:"form",
items:[{
xtype:"textfield",
fieldLabel: '合同',
name: 'contractId2',
width:100
}]
}]},//第一行结束
{//第一行
layout:"column",
items:[{
columnWidth:.3,//第一列
layout:"form",
items:[{
xtype:"textfield",
fieldLabel: '合同编号',
name: 'contractId',
width:100
}]
},{
columnWidth:.3,//第二列
layout:"form",
items:[{
xtype:"textfield",
fieldLabel: '合同名称',
name: 'contractId1',
width:100
}]
},{
columnWidth:.3,//第三列
layout:"form",
items:[{
xtype:"textfield",
fieldLabel: '合同',
name: 'contractId2',
width:100
}]
}]},//第一行结束
{//第一行
layout:"column",
items:[{
columnWidth:.3,//第一列
layout:"form",
items:[{
xtype:"textfield",
fieldLabel: '合同编号',
name: 'contractId',
width:100
}]
},{
columnWidth:.3,//第二列
layout:"form",
items:[{
xtype:"textfield",
fieldLabel: '合同名称',
name: 'contractId1',
width:100
}]
},{
columnWidth:.3,//第三列
layout:"form",
items:[{
xtype:"textfield",
fieldLabel: '合同',
name: 'contractId2',
width:100
}]
}]}//第一行结束
]
});
var win = new Ext.Window(
{
id:"window",
title: " 合同信息 " ,
layout: 'border',
width:600,
height:500,
closeAction:'hide',
plain: true,
items:[new Ext.TabPanel({
region: 'center',
deferredRender: false,
// layoutOnTabChange:true,//在TabPanel中采用column布局时,有时需要设置该属性
activeTab: 0, //活动的tab索引
items: [{
//contentEl: 'tab1',
title: '合同明细',
closable: false, //关闭项
autoScroll: false, //是否自动显示滚动条
layout:'fit',
collapsible: true,
split:true,
margins:'0 0 0 0',
items:[detailForm]
},{
//contentEl: 'tab2',
title: '规格明细',
closable: false, //关闭项
autoScroll: false, //是否自动显示滚动条
layout:'fit',
collapsible: true,
split:true,
margins:'0 0 0 0'
}]
})],
buttons: [{
text:'Submit',
disabled:true
},{
text: 'Close',
handler: function(){
win.hide();
// detailForm.destroy();
}
}]
});
//显示窗口
win.show();
});
Extjs Column布局常见问题及解决方法的更多相关文章
- Extjs 兼容IE8常见问题及解决方法
1. 在IE8中整个页面都打不开,一般情况是: 页面组件中最后一个属性出现了逗号 没有多余的逗号,就很有可能是组件中没有设置renderTo:Ext.getBody(); 2. 页面按钮颜色失效 自定 ...
- NHibernate常见问题及解决方法
NHibernate常见问题及解决方法 曾经学过NHibernate的,但是自从工作到现在快一年了却从未用到过,近来要巩固一下却发现忘记了许多,一个"in expected: <end ...
- C#用ado.net访问EXCEL的常见问题及解决方法
C#用ado.net访问EXCEL的常见问题及解决方法,除了像sql server,access常见的数据库,其实Excel文件也可以做为数据库访问. ado.net访问excel的实例: OleDb ...
- Nacos 常见问题及解决方法
Nacos 开源至今已有一年,在这一年里,得到了很多用户的支持和反馈.在与社区的交流中,我们发现有一些问题出现的频率比较高,为了能够让用户更快的解决问题,我们总结了这篇常见问题及解决方法,这篇文章后续 ...
- 安装scrapy框架的常见问题及其解决方法
下面小编讲一下自己在windows10安装及配置Scrapy中遇到的一些坑及其解决的方法,现在总结如下,希望对大家有所帮助. 常见问题一:pip版本需要升级 如果你的pip版本比较老,可能在安装的过程 ...
- PS切图导出代码后出现的图片布局散乱的解决方法——table布局
前言: 一般来说,大部分美工PS切图后导出的都是使用PS默认的table布局的页面,出现最多的异常是上传代码,替换图片后,发现图片布局散乱,完全不是想要的效果.轻微的是浏览器不兼容,只有部分浏览器可以 ...
- IIS_常见问题及解决方法
配置错误 在唯一密钥属性“value”设置为“default.aspx”时,无法添加类型为“add”的重复集合项 配置文件 \\*******\web\web.config web.config中 & ...
- AppFuse 3常见问题与解决方法
非常长一段时间没做SSH项目了.近期抽出时间看了一下升级到3.x的appfuse,对新版本号使用过程中出现的一些问题进行了排查.汇总例如以下.以备后用.本文原文出处: http://blog.csdn ...
- python网络爬虫(1)——安装scrapy框架的常见问题及其解决方法
Scrapy是为了爬取网站数据而编写的一款应用框架,出名,强大.所谓的框架其实就是一个集成了相应的功能且具有很强通用性的项目模板. 其实在Linux和 Mac安装,就简单的pip命令即可: pip i ...
随机推荐
- Openwrt VLAN Configure(2)
1 Scope of Document This document describes vlan design on nodewrt2p 2 Requiremen 2.1 ...
- python3.6 连接mysql数据库
==================pymysql=================== 由于 MySQLdb 模块还不支持 Python3.x,所以 Python3.x 如果想连接MySQL需要安装 ...
- HDU 2767 Proving Equivalences (Tarjan)
Proving Equivalences Time Limit : 4000/2000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other ...
- celery(一)分布式任务调度模块简介及运行环境
Celery是Python开发的分布式任务调度模块. Celery本身不含消息服务,它使用第三方消息服务来传递任务. django下有个分支Django-Celery,可以结合django来实现任务的 ...
- js取的随机数
Math.round(Math.random()*1000+1) ;//取得1-1000的随即数
- GMTcolor
http://gmt-tutorials.org/coloring_topography.html gmt grdcut topo15.grd -R -Gcut gmt grdgradient cut ...
- Introduction of Build Tool/Maven, Gradle
什么是build tool: build tool是可以自动由源代码创建可执行的应用程序的程序. Building 包括编译.链接和打包代码成一个可用的或可执行形式. 在小型项目,开发人员常常会手动调 ...
- Andriod Studio 解决问题 Failed to resolve: com.android.support:appcompat-v7:28.+
Andriod Studio报错提示: Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:28.+ 原因:Andri ...
- php 加载字体 并保存成图片
// Set the content-type header("Content-type: image/png"); // Create the image $im = image ...
- CTF-练习平台-Misc之 Linux基础1
十四.Linux基础1 下载打开文件,解压后发下是一个没有后缀名的文件,添加后缀名为txt,搜索关键词“KEY”,发现flag Linux???不存在的!