【EasyUI】——EasyUI的布局
做一个站点首先要有站点的布局,所谓的布局事实上就是网页的排版。就是说你的网页显示时是什么样子的。
就比方百度的首页:
无论是谁登录。网页都是这个样式的。
EasyUI中的网页布局一共分为五部分,分别为东。西。南,北,中。在设计自己的网页布局时,中间部分是必需要有的。其余四部分能够不用。由于其余四部分的位置是依据中间部分位置来计算的。EasyUI的布局样式有非常多。能够选择自己合适的布局使用,另外能够设置布局中的一些属性值。来使布局更适合自己的网页。
分类
1、基本布局
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
<span style="font-family:KaiTi_GB2312;font-size:18px;"><span style="font-family:KaiTi_GB2312;font-size:18px;"><div class="easyui-layout" style="width: 700px; height: 350px;">
<div data-options="region:'north'" style="height: 50px"></div>
<div data-options="region:'south',split:true" style="height: 50px;"></div>
<div data-options="region:'east',split:true" title="East" style="width: 100px;"></div>
<div data-options="region:'west',split:true" title="West" style="width: 100px;"></div>
<div data-options="region:'center',title:'Main Title',iconCls:'icon-ok'">
<table class="easyui-datagrid"
data-options="url:'datagrid_data1.json',method:'get',border:false,singleSelect:true,fit:true,fitColumns:true">
<thead>
<tr>
<th data-options="field:'itemid'" width="80">Item ID</th>
<th data-options="field:'productid'" width="100">Product ID</th>
<th data-options="field:'listprice',align:'right'" width="80">List Price</th>
<th data-options="field:'unitcost',align:'right'" width="80">Unit Cost</th>
<th data-options="field:'attr1'" width="150">Attribute</th>
<th data-options="field:'status',align:'center'" width="60">Status</th>
</tr>
</thead>
</table>
</div>
</div></span></span>
2、可加入和删除part的布局
<span style="font-family:KaiTi_GB2312;font-size:18px;"><span style="font-family:KaiTi_GB2312;font-size:18px;"><h2>Add and Remove Layout</h2>
<p>Click the buttons below to add or remove region panel of layout.</p>
<div style="margin: 20px 0;">
<span>Select Region Panel:</span>
<select id="region">
<option value="north">North</option>
<option value="south">South</option>
<option value="east">East</option>
<option value="west">West</option>
</select>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="addPanel()">Add</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="removePanel()">Remove</a>
</div>
<div id="cc" class="easyui-layout" style="width: 700px; height: 350px;">
<div data-options="region:'north'" style="height: 50px"></div>
<div data-options="region:'south',split:true" style="height: 50px;"></div>
<div data-options="region:'east',split:true" title="East" style="width: 100px;"></div>
<div data-options="region:'west',split:true" title="West" style="width: 100px;"></div>
<div data-options="region:'center',title:'Center'"></div>
</div>
<script type="text/javascript">
function addPanel() {
var region = $('#region').val();
var options = {
region: region
};
if (region == 'north' || region == 'south') {
options.height = 50;
} else {
options.width = 100;
options.split = true;
options.title = $('#region option:selected').text();
}
$('#cc').layout('add', options);
}
function removePanel() {
$('#cc').layout('remove', $('#region').val());
}
</script></span></span>
3、可自己主动适应内容高度的布局
<span style="font-family:KaiTi_GB2312;font-size:18px;"><span style="font-family:KaiTi_GB2312;font-size:18px;"><h2>Auto Height for Layout</h2>
<p>This example shows how to auto adjust layout height after dynamically adding items.</p>
<div style="margin: 20px 0;">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="addItem()">Add Item</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="removeItem()">Remove Item</a>
</div>
<div id="cc" style="width: 700px; height: 350px;">
<div data-options="region:'north'" style="height: 50px"></div>
<div data-options="region:'south'" style="height: 50px;"></div>
<div data-options="region:'west'" style="width: 150px;"></div>
<div data-options="region:'center'" style="padding: 20px">
<p>Panel Content.</p>
<p>Panel Content.</p>
<p>Panel Content.</p>
<p>Panel Content.</p>
<p>Panel Content.</p>
</div>
</div>
<script type="text/javascript">
$(function () {
$('#cc').layout();
setHeight();
}); function addItem() {
$('#cc').layout('panel', 'center').append('<p>More Panel Content.</p>');
setHeight();
} function removeItem() {
$('#cc').layout('panel', 'center').find('p:last').remove();
setHeight();
} function setHeight() {
var c = $('#cc');
var p = c.layout('panel', 'center'); // get the center panel
var oldHeight = p.panel('panel').outerHeight();
p.panel('resize', { height: 'auto' });
var newHeight = p.panel('panel').outerHeight();
c.height(c.height() + newHeight - oldHeight);
c.layout('resize');
}
</script></span></span>
4、复杂布局(包括动态菜单条)
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
<span style="font-family:KaiTi_GB2312;font-size:18px;"><span style="font-family:KaiTi_GB2312;font-size:18px;"><h2>Complex Layout</h2>
<p>This sample shows how to create a complex layout.</p>
<div style="margin: 20px 0;"></div>
<div class="easyui-layout" style="width: 700px; height: 350px;">
<div data-options="region:'north'" style="height: 50px"></div>
<div data-options="region:'south',split:true" style="height: 50px;"></div>
<div data-options="region:'east',split:true" title="East" style="width: 180px;">
<ul class="easyui-tree" data-options="url:'tree_data1.json',method:'get',animate:true,dnd:true"></ul>
</div>
<div data-options="region:'west',split:true" title="West" style="width: 100px;">
<div class="easyui-accordion" data-options="fit:true,border:false">
<div title="Title1" style="padding: 10px;">
content1 </div>
<div title="Title2" data-options="selected:true" style="padding: 10px;">
content2 </div>
<div title="Title3" style="padding: 10px">
content3 </div>
</div>
</div>
<div data-options="region:'center',title:'Main Title',iconCls:'icon-ok'">
<div class="easyui-tabs" data-options="fit:true,border:false,plain:true">
<div title="About" data-options="href:'_content.html'" style="padding: 10px"></div>
<div title="DataGrid" style="padding: 5px">
<table class="easyui-datagrid"
data-options="url:'datagrid_data1.json',method:'get',singleSelect:true,fit:true,fitColumns:true">
<thead>
<tr>
<th data-options="field:'itemid'" width="80">Item ID</th>
<th data-options="field:'productid'" width="100">Product ID</th>
<th data-options="field:'listprice',align:'right'" width="80">List Price</th>
<th data-options="field:'unitcost',align:'right'" width="80">Unit Cost</th>
<th data-options="field:'attr1'" width="150">Attribute</th>
<th data-options="field:'status',align:'center'" width="50">Status</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div></span></span>
5、适应全屏的布局
<span style="font-family:KaiTi_GB2312;font-size:18px;"><span style="font-family:KaiTi_GB2312;font-size:18px;"><body class="easyui-layout">
<div data-options="region:'north',border:false" style="height:60px;background:#B3DFDA;padding:10px">north region</div>
<div data-options="region:'west',split:true,title:'West'" style="width:150px;padding:10px;">west content</div>
<div data-options="region:'east',split:true,collapsed:true,title:'East'" style="width:100px;padding:10px;">east region</div>
<div data-options="region:'south',border:false" style="height:50px;background:#A9FACD;padding:10px;">south region</div>
<div data-options="region:'center',title:'Center'"></div>
</body>
</span></span>
6、嵌套的布局
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
<span style="font-family:KaiTi_GB2312;font-size:18px;"><span style="font-family:KaiTi_GB2312;font-size:18px;"><h2>Nested Layout</h2>
<p>The layout region panel contains another layout or other components.</p>
<div style="margin: 20px 0;"></div>
<div class="easyui-layout" style="width: 700px; height: 350px;">
<div data-options="region:'north'" style="height: 50px"></div>
<div data-options="region:'south',split:true" style="height: 50px;"></div>
<div data-options="region:'east',split:true" title="East" style="width: 180px;"></div>
<div data-options="region:'west',split:true" title="West" style="width: 100px;"></div>
<div data-options="region:'center',iconCls:'icon-ok'" title="Center">
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'north',split:true,border:false" style="height: 50px"></div>
<div data-options="region:'west',split:true,border:false" style="width: 100px"></div>
<div data-options="region:'center',border:false"></div>
</div>
</div>
</div></span></span>
7、无收缩button的布局
<span style="font-family:KaiTi_GB2312;font-size:18px;"><span style="font-family:KaiTi_GB2312;font-size:18px;"><h2>No collapsible button in Layout</h2>
<p>The layout region panel has no collapsible button.</p>
<div style="margin: 20px 0;"></div>
<div class="easyui-layout" style="width: 700px; height: 350px;">
<div data-options="region:'north'" style="height: 50px"></div>
<div data-options="region:'south',split:true" style="height: 50px;"></div>
<div data-options="region:'east',split:true,title:'East',collapsible:false" style="width: 250px;">
<table id="tt" class="easyui-propertygrid" data-options="
url: 'propertygrid_data1.json',
method: 'get',
showGroup: true,
fit: true,
border: false
">
</table>
</div>
<div data-options="region:'center',title:'Main Title',iconCls:'icon-ok',href:'_content.html'" style="padding: 10px">
</div>
</div></span></span>
属性方法
| 方法名 | 方法属性 | 描写叙述 |
| resize | none | 设置布局大小 |
| panel | region | 返回指定面板,“region”參数可用值有:north。south,east,west,center。 |
| collapse | region | 折叠指定面板,“region”參数可用值有:north。south,east。west。 |
| expand | region | 展开指定面板,“region”參数可用值有:north。south。east,west。 |
| add | options | 加入指定面板。属性參数是一个配置对象 |
| remove | region | 移除指定的面板,“region”參数可用值有:north。south,east。west。 |
方法应用比方:
折叠布局面板:$('#cc').layout('collapse','west');
加入西区面板:
<span style="font-family:KaiTi_GB2312;font-size:18px;"><span style="font-family:KaiTi_GB2312;font-size:18px;">$('#cc').layout('add',{
region: 'west',
width: 180,
title: 'West Title',
split: true,
});</span></span>
当中设置的属性即西区面板的属性。如region表示面板的位置。width为面板宽度,title为面板标题,split为用户能否够改变面板大小。
| 属性值 | 属性值类型 | 描写叙述 | 默认值 |
| fit | boolean | 假设设置为true,布局组件将自适应父容器。当使用'body'标签创建布局的时候,整个页面会自己主动最大。 |
false |
| 属性值 | 属性值类型 | 描写叙述 | 默认值 |
| title | string | 布局面板标题文本 | null |
| region | string | 定义布局面板位置,可用的值有:north,south,east,west。center。 | |
| border | boolean | 为true时显示布局面板的边框 | true |
| split | boolean | 为true时用户能够改变每一面板大小 | false |
| iconCls | string | 一个包括图标的CSS类的ID。该图标将会显示到面板标题上 | null |
| href | string | 用于读取远程网站数据的URL链接 | null |
| collapsible | boolean | 定义是否显示折叠button | true |
| minWidth | number | 最小面板宽度 | 10 |
| minHeight | number | 最小面板高度 | 10 |
| maxWidth | number | 最大面板宽度 | 10000 |
| maxHeight | number | 最大面板高度 | 10000 |
总结
每接触什么东西都认为非常难,事实上就是没有和曾经的知识结合起来,仅仅要以自己学过的知识为基础。再去学自己所谓的新的东西,那么这些东西也就变得简单了。
【EasyUI】——EasyUI的布局的更多相关文章
- EasyUI之Layout布局和Tabs页签的使用
1.JQuery EasyUI之LayOut布局 EasyUI是一款基于JQuery开发的前端框架,它集成很多漂亮的样式和相应的功能,大大方便了我们对前端开发的难度.对于web项目而言,主页面的一定是 ...
- 第二百零二节,jQuery EasyUI,Layout(布局)组件
jQuery EasyUI,Layout(布局)组件 学习要点: 1.加载方式 2.布局属性 3.区域面板属性 4.方法列表 本节课重点了解 EasyUI 中 Layout(布局)组件的使用方法,这个 ...
- Jquery EasyUi实战教程布局篇
转自:http://www.kwstu.com/ArticleView/kwstu_20139413501290 送给大家一个非常好的后台布局模板,本人后来就选择了这个模板http://www.kws ...
- CI 笔记3 (easyui 的layout布局,最小化layout原型)
在做easyui的layout的布局时,最小化一个原型,分2步,一个是div的父标签,一个是body做父标签,全屏的. 步骤分别为: 在设置的5个区中,div的最后一个,必须是data-options ...
- easyui div 上下布局 最大化按钮 隐藏标题
背景:easyui在做上下布局的时候,上面是数据列表,下面是数据图表.如下图 需要在上下面板右上角加上最大化按钮,以便可以全屏显示.逻辑就是当上面点击最大化时候,隐藏下面,主意:此时需要将下面的div ...
- easyui datagrid 高度布局自适应
最近在把以前写的一个项目改成用easyui做前端.过程中遇到了不少问题.其中一个就是datagrid不能很好的布局.想了好多办法都有局限.最后想到会不会是布局(easyui-layout)的问题,经过 ...
- easyUI的基础布局easyui-accordion
---恢复内容开始--- <html> <head> <meta charset="UTF-8"> <title>树状图</t ...
- easyUI的基础布局
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
- jquery+easyui主界面布局一例
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="workbench.aspx ...
- Easyui几种布局方式的使用
1.通过标记创建layout. 记得添加"easyui-layout"样式给div标记. <div id="cc" class="easyui ...
随机推荐
- 注入AspectJ切面
为什么要用AspectJ:AspectJ提供了Spring AOP很多不能实现的多种切点类型(比如属性,构造方法切入,由于不能实现构造方法的切入spring aop就不能实现对象创建过程的通知) As ...
- T型知识实践结构的力量(转载)
最近在做的一些新的事情,这其中获得的一些新的思考. T型的知识积累,深度的挖掘可以通过"举一反三"的应用在广度上,广度可以通过"交叉验证"加强我们的认识,可以说 ...
- Google的代码高亮-code-prettify
前不久发现,在wordpress中贴代码的时候,发现code标签并没有意料中的好使用,在贴代码的时候没有高亮真的是一件无法忍受的事情. 正巧,两周前听过同事Eason的一个关于Markdown的分享, ...
- 【BZOJ 2822】2822: [AHOI2012]树屋阶梯(卡特兰数+高精度)
2822: [AHOI2012]树屋阶梯 Description 暑假期间,小龙报名了一个模拟野外生存作战训练班来锻炼体魄,训练的第一个晚上,教官就给他们出了个难题.由于地上露营湿气重,必须选择在高处 ...
- 【带修改的主席树】BZOJ1901-Dynamic Rankings
稍后整理笔记.这题数据范围好像有点问题? #include<iostream> #include<cstdio> #include<cstring> #includ ...
- 九月回顾 这篇文章和ACM毫无关系= =
其实不只是九月的回顾吧,我大概想把暑假到现在10.01发生的啥事儿都说下吧~ 嗯,我是一个比较沙茶的人,不过运气比较好吧. 高中啊,这个谈起来话就长了,在校什么风采之星大赛上,我认识了个妹子,当时感觉 ...
- PAT甲级1017. Queueing at Bank
PAT甲级1017. Queueing at Bank 题意: 假设一家银行有K台开放服务.窗前有一条黄线,将等候区分为两部分.所有的客户都必须在黄线后面排队,直到他/她轮到服务,并有一个可用的窗口. ...
- 在阅读sqlmap源码时学到的知识--检查运行环境
最近在读sqlmap的源码,懵懵懂懂中页大约学到了一些知识(说给自己听的话:由此可见,所谓的能够解决所有遇到问题的python水平,只能说明你遇见的都是简单的需求....),老规矩,在这里写一下,一则 ...
- linuxmint - setup - 搜狗输入法
安装好linuxmint18后,官网下载搜狗输入法安装包安装.安装成功后,发现缺失部分界面,包括输入候选框,软件设置,fcitx设置都不太正常. 解决: 安装:fcitx-ui-classic 另: ...
- Make a printer-port EEPROM programmer and dongle
You can easily use a PC's printer port for serial-EEPROM programming. You can use a device-programme ...