读书人

ExtJS3.2 已经有了tableform格局(bug

发布时间: 2012-11-01 11:11:32 作者: rapoo

ExtJS3.2 已经有了tableform布局(bug fix)
(最新修改:覆盖renderAll方法,使得hidden类型的控件不布局)

通过不懈的google,终于还是在Extjs上找到了tableform 布局的代码,这可以终结网上大部分通过hbox,或者column来布局form 的代码例子了。


先看一个例子

var form = new Ext.form.FormPanel({
renderTo:'content',
layout:'tableform',
width:600,
frame:true,
title:'test',
layoutConfig: { columns: 2 },
items: [
{ fieldLabel: 'Created By:', xtype: 'textfield'
},
{ fieldLabel: 'Author:', xtype: 'textfield'
},

{ fieldLabel: 'Creation Date:', xtype: 'datefield' },
{ fieldLabel: 'to', xtype: 'datefield' },
{ fieldLabel: 'Modified By', xtype: 'textfield',colspan: 2},
{ fieldLabel: 'Modified Date:', xtype: 'datefield' },
{ fieldLabel: 'to', xtype: 'datefield' },



})



tableform的好处是你可以一直增加表单还不用考虑布局。这个有点类似我8年前swing布局中写的一个布局管理器
代码如下,也可以在此链接找到最新更新:http://www.sencha.com/forum/showthread.php?59897-Ext.layout.TableFormLayout-%28v2%29/page3

当试用panel当做面板装载 form时  xtype=hidden的控件能被隐藏掉  但是当用window弹出窗口装载 form时  会报错:
this.getLayoutTargetSize is not a function
[在此错误处中断] var viewSize = this.getLayoutTargetSize(ct, target);
错误出现再 26行出
getLayoutTargetSize : Ext.layout.AnchorLayout.prototype.getLayoutTargetSize,

应该是getLayoutTargetSize 取不到值 但是我不知道这句话是什么意思 请大家帮忙解决一下

读书人网 >JavaScript

热点推荐