当前位置: 首页 > 图文教程 > 网络编程 > Javascript > ExtJS的FieldSet的column列布局

Javascript
纯JS半透明Tip效果代码
JavaScript 读URL参数增强改进版版
JS对URL字符串进行编码/解码分析
javescript完整操作Table的增加行,删除行的列子大全
js可填可选的下拉框
prototype Element学习笔记(篇一)
prototype Element学习笔记(篇二)
prototype Element学习笔记(Element篇三)
Prototype使用指南之selector.js说明
不唐突的JavaScript的七条准则整理收集
js判断变量是否空值的代码
Firefox getBoxObjectFor getBoundingClientRect联系
Div自动滚动到末尾的代码
javascript笔试题目附答案
javascript引导程序
js身份证验证超强脚本
JS给元素注册事件的代码
JavaScript函数、方法、对象代码
JS写的数字拼图小游戏代码[学习参考]
关于B/S判断浏览器断开的问题讨论

Javascript 中的 ExtJS的FieldSet的column列布局


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 1187 ::
收藏到网摘: n/a

ExtJS的FieldSet的column列布局,需要的朋友可以参考下。 以下是自己扩展的FieldSet:
复制代码 代码如下:

ME.Base.FieldSet = Ext.extend(Ext.form.FieldSet, {
layout: 'column',
fieldSetItems: [],
autoScroll:false,
defaults: {
layout: 'form',
labelAlign: 'right',
labelWidth: 65,
columnWidth: .25,
defaults: {
anchor: '96%'
}
},
initComponent: function(){
var thisItems = new Array();
var itemsLen = this.fieldSetItems.length;
if(itemsLen > 0){
for (var i = 0; i < itemsLen; i++){
thisItems[thisItems.length] = {
items: this.fieldSetItems[i]
}
}
}
this.items = thisItems;
ME.Base.FieldSet.superclass.initComponent.call(this);
}
});

复制代码 代码如下:

new ME.Base.FieldSet({
title: '基本信息',
autoHeight: true,
fieldSetItems: [{
xtype : 'textfield',
fieldLabel : "用户姓名",
name : 'USER_NAME'
}, {
xtype : 'textfield',
inputType : 'password',
fieldLabel : "用户密码",
name : 'PASSWORD'
}, {
xtype : 'textfield',
fieldLabel : "手机号码",
name : 'MOBILE'
}, {
xtype : 'textfield',
fieldLabel : "手机号码",
name : 'sss'
},{
xtype : 'textfield',
fieldLabel : "手机号码",
name : 'eee'
}]

  这样可以实现各个组件固定宽度,并随着Item个数的增长而自动延伸,保证整齐效果。
  可是,展现的结果总是会出现边框,每一个组件外面包裹的那个容器都有边框,非常难看。
  其实在列模式的每个容器配置项里加入
xtype: 'container',
autoEl: {},
  即可:
复制代码 代码如下:

ME.Base.FieldSet = Ext.extend(Ext.form.FieldSet, {
layout: 'column',
fieldSetItems: [],
autoScroll:false,
defaults: {
xtype: 'container',
autoEl: {},
layout: 'form',
labelAlign: 'right',
labelWidth: 65,
columnWidth: .25,
defaults: {
anchor: '96%'
}
},
initComponent: function(){
var thisItems = new Array();
var itemsLen = this.fieldSetItems.length;
if(itemsLen > 0){
for (var i = 0; i < itemsLen; i++){
thisItems[thisItems.length] = {
items: this.fieldSetItems[i]
}
}
}
this.items = thisItems;
ME.Base.FieldSet.superclass.initComponent.call(this);
}
});