Easy-UI中datagrid宽高自适应问题

在使用easy-ui的过程中,新增tab中利用iframe显示时,发现里面的datagrid高度不能自适应,下面是解决办法,写下备用:

iframe中使用easyui-layout布局,然后把datagrid放到center就可以了,比如:

<body class="easyui-layout">
<div region="center" style="padding:5px;" border="false">
<table id="tt" title="datagrid" fit="true" iconcls="icon-edit" singleselect="true" idfield="itemid" url="datagrid_data2.asp" pagination="true" rownumbers="true">
<thead>
<tr>
<th field="itemid" width="80" checkbox="true">item id</th>
<th field="productid" width="100" sortable="true">product</th>
<th field="listprice" width="80" sortable="true" align="right">list price</th>
<th field="unitcost" width="80" sortable="true" align="right">unit cost</th>
<th field="attr1" sortable="true" width="150">attribute</th>
<th field="status" width="60" sortable="true" align="center">status</th>
</tr>
</thead>
</table>
</div>
</body>
像这样布局高度就可以自适应了,但是宽度依然无法自适应。

宽度自适应方法如下:

加上一个属性:

fitColumns: true,
/*自动扩大或缩小列的尺寸以适应表格的宽度并且防止水平滚动,使之保持与父类宽度相同*/
原文: http://duzou.tk/archives/51.html

转载于:https://my.oschina.net/pljhonglu/blog/108720

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值