extjs 怎么向TabPanel中加入一个 FormPanel

蓝翔招生办 2008-05-22 05:17:13
TabPanel的代码如下:
Ext.onReady(function(){

var tabs = new Ext.TabPanel({
renderTo:'tabs',
resizeTabs:true, // turn on tab resizing
minTabWidth: 115,
tabWidth:135,
enableTabScroll:true,
width:584,
height:250,
defaults: {autoScroll:true},
plugins: new Ext.ux.TabCloseMenu()
});

// tab generation code
var index = 0;
while(index < 3){
addTab();
}
function addTab(){
tabs.add({
title: '用户信息 ' + (++index),
iconCls: 'tabs',
html: '表格 ' + (index) + '<br/><br/>'
+ Ext.example.bogusMarkup,
//items: simple,
closable:true
}).show();
}

new Ext.Button({
text: '添加一表格',
handler: addTab,
iconCls:'new-tab'
}).render(document.body, 'tabs');
});

FormPanel的代码如下:
var simple = new Ext.FormPanel({
labelWidth: 60, // label settings here cascade unless overridden
url:'dynamic.html',
frame:true,
title: '',
bodyStyle:'padding:5px 5px 0',
width: 350,
defaults: {width: 230},
defaultType: 'textfield',

items: [{
fieldLabel: '乘机人',
name: 'AirPerson',
allowBlank:false
},{
fieldLabel: '证件类型',
name: 'Id'
},{
fieldLabel: '证件号码',
name: 'IdNo'
}, {
fieldLabel: '国籍',
name: 'country' ,

}, new Ext.form.ComboBox({
fieldLabel: 'State',
hiddenName:'state',
store: new Ext.data.SimpleStore({
fields: ['abbr', 'state'],
data : Ext.exampledata.states // from states.js
}),
valueField:'abbr',
displayField:'state',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'请选择性别...',
selectOnFocus:true,
width:190
}),{
fieldLabel: '出生日期',
name: 'birthday'
},{
fieldLabel: '联系电话',
name: 'telephone'
},{
fieldLabel: '签发地',
name: 'visaAddress'
}
],

buttons: [{
text: '保存'
},{
text: '取消'
}]
});

simple.render(document.body);

我遇到的问题是怎么把这个form 加入到这个table中去,向高手请较!
...全文
1961 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
gdaFIFA 2011-06-06
  • 打赏
  • 举报
回复
学习中。。。
生财 2009-06-03
  • 打赏
  • 举报
回复
学习了.....
太乙 2008-05-24
  • 打赏
  • 举报
回复
http://d.download.csdn.net/down/436040/qingyuan_z
biggates_86 2008-05-23
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 zhouruitao 的回复:]
直接调用TabPanel的add方法即可,添加后要调用doLayout方法渲染页面。
tabs.add(simple);
tabs.doLayout();
[/Quote]
这样就可以了。不过如果需要对simple进行进一步的控制的话,建议每个simple的实例使用不同的ID,否则在IE下面会出现比较恶心的错误。
蓝翔招生办 2008-05-22
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 biggates_86 的回复:]
汗 没明白LZ什么意思
是每次单击按钮都新建一个Tab,然后把Form作为tabPanel的内容添加过去吗?
[/Quote]

就是这个意思,有什么好的方法吗
魔豆爸 2008-05-22
  • 打赏
  • 举报
回复
直接调用TabPanel的add方法即可,添加后要调用doLayout方法渲染页面。
tabs.add(simple);
tabs.doLayout();
biggates_86 2008-05-22
  • 打赏
  • 举报
回复
汗 没明白LZ什么意思
是每次单击按钮都新建一个Tab,然后把Form作为tabPanel的内容添加过去吗?

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧