extjs 表单设置html5,HTML Form to ExtJS Form

在尝试将HTML表单转换为ExtJS并显示在窗口中时,遇到了布局问题。尽管使用了table布局,但字段并未根据rowspan和colspan占据更多空间,且窗口缩放时表格不会相应调整大小。已尝试fit和table布局,以及anchor布局,但效果不佳。寻求解决表格自适应和字段尺寸调整的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I have an html form in which the fields are extremely scattered. The page has been created using html table - rowspan and colspan combinations.

I need to convert this form to ExtJS and display it in a window.

After carrying out some research, I feel that table layout could be best choice for positioning the fields. But there are few issues which I have been facing as following:

If I give rowspan or colspan as 2 or more, then also the fields don't increase in size to occupy the availabe space and remain confined to single column.

If I resize the window, then the table doesn't resize (though, the form does as the tbar present at the top expand to occupy the complete space).

I have used the layout as 'fit' for window and layout as 'table' for the form.

I have also tried using 'anchor' layout for form and then having a fieldset with table layout, but the positioning didn't work.

Could someone please throw some light on this. Following is a basic code snippet I am using:

var form = Ext.create('Ext.form.Panel', {

url:'voyage_berth_monitoring.php',

fieldDefaults: {

labelAlign: 'right'

},

layout:{

type:'table',

columns:3

},

defaults:{

anchor:'100%'

},

tbar:[

{

xtype:'button',

text:'Clear'

},

{

xtype:'button',

text:'Delete'

},

{

xtype:'tbfill'

},

{

xtype:'button',

text:'Save'

},

{

xtype:'button',

text:'Exit'

}

],

items: [

{

fieldLabel:'item',

xtype:'textfield'

},

{

fieldLabel:'item',

xtype:'textfield',

colspan:2

},

{

fieldLabel:'item',

xtype:'textfield'

},

{

fieldLabel:'item',

xtype:'textfield'

},

{

fieldLabel:'item',

xtype:'textfield'

}

]

});

var win = Ext.create('Ext.window.Window', {

title: 'Window',

closable: true,

closeAction:'hide',

minimizable:true,

maximizable:true,

height:350,

width:750,

layout:'fit',

autoScroll:true,

items: form

});

win.show();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值