[转载]easyui 布局自适应 – 五行缺酒 – 博客园
- JavaScript
- 2014-06-20
- 101热度
- 0评论
[转载]easyui 布局自适应 - 五行缺酒 - 博客园.
最近在把以前写的一个项目改成用easyui做前端。过程中遇到了不少问题。其中一个就是datagrid不能很好的布局。想了好多办法都有局限。最后想到会不会是布局(easyui-layout)的问题,经过实验,最后问题解。
[html]
<div>查询条件</div>
<table class="easyui-datagrid" fit="true"></table>
[/html]
正确的写法:
[html]
<div class="easyui-layout" data-options="fit:true">
<div style="height: 100px;" data-options="region:'north'">
<div>查询条件</div>
</div>
<div data-options="region:'center'"></div>
</div>
[/html]
[html]
<body class="easyui-layout">
<div data-options="region:'north'" style="height:100px">
<table id="part1"></table>
</div>
<div data-options="region:'center'">
<table id="part2"></table>
</div>
</div>
[/html]
情形2:
[html]
<div class="easyui-layout"data-options="fit:true">
<div data-options="region:'north'" style="height:100px">
<table id="part1"></table>
</div>
<div data-options="region:'center'">
<table id="part2"></table>
</div>
</div>
[/html]
3:在html中定义easyui时,下面两种写法是一样的。即easyui控件的属性可以写在dataoptions属性里,也可以把这些属性写到标签上。
写法1:
[html]
<div class="easyui-layout"data-options="fit:true">
<div data-options="region:'north'" style="height:100px">
<table id="part1"></table>
</div>
<div data-options="region:'center'">
<table id="part2"></table>
</div>
</div>
[/html]
写法2:
[html]
<div class="easyui-layout"fit="true">
<div region="north"style="height:100px;">
<table id="part1"></table>
</div>
<div region="center">
<table id="part2"></table>
</div>
</div>
[/html]