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

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

iframe中使用easyui-layout布局,而后把datagrid放到center就能够了,好比: shell

<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>
像这样布局高度就能够自适应了,可是宽度依然没法自适应。

宽度自适应方法以下: 布局

加上一个属性: ui

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