03-EasyUI_panel

panel的使用

 - panel属性的设置

 - panel方法的调用

 - 属性iconCls的设置

 - open/close/destroy方法


1. 官方对panel的解释


    The panel is used as a container for other contents. 
    It is the base component for building other components such as layout, tabs, accordion, etc. 
    It also provides built-in collapsible, closable, maximizable and minimizable behavior and other customized behavior. 
    Panels can be easily embedded into any position of web page.  

2. 设置panel的属性


 2.1 设置方式(二种)


 (1) 以给dom结点设置属性的方式

<div id="p" 
    class="easyui-panel" 
    title="My Panel by class"
    style="width:500px;height:150px;padding:10px;background:#fafafa;"
    collapsible="true"
    minimizable="true"
    maximizable="true"
    closable="true"
    iconCls="icon-save"
>


 (2) $("#p").panel({属性名1:属性值1, ...})

		// 设置panel的属性 $("#p").panel({....})
		$('#p').panel({
			width : 500,
			height : 150,
			title : 'My Panel',
			tools : [ {
				iconCls : 'icon-add',
				handler : function() {
					alert('new')
				}
			}, {
				iconCls : 'icon-save',
				handler : function() {
					alert('save')
				}
			} ]
		});



2.2 常用属性


    collapsible : 折叠 按钮 , 默认没有
    minimizable : 最小化 按钮, 默认没有
    maximizable : 最小化按钮
    closable    : 关闭按钮
    fit : to set the panel size fit it's parent container. 

    iconCls     : 图标, 请参考 themes/icon.css 中的图标

3. 调用panel的方法


 3.1 方式


    $('#p').panel('methodName')

 3.2 常用方法    


    open, close, destroy

4. 完整程序 

<html>
<head>
<title>01.html</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!-- js: jQuery -->
<script type="text/javascript"
	src="js/jquery-easyui-1.2.6/jquery-1.7.2.min.js"></script>

<!-- js: EasyUI -->
<script type="text/javascript"
	src="js/jquery-easyui-1.2.6/jquery.easyui.min.js" charset="UTF-8"></script>

<!-- js: I18N -->
<script type="text/javascript"
	src="js/jquery-easyui-1.2.6/locale/easyui-lang-zh_CN.js"></script>

<!-- css: theme -->
<link rel="stylesheet"
	href="js/jquery-easyui-1.2.6/themes/default/easyui.css">
<link>

<!-- css: icon -->
<link rel="stylesheet" href="js/jquery-easyui-1.2.6/themes/icon.css">
<link>
<!--  
The panel is used as a container for other contents. 
It is the base component for building other components such as layout, tabs, accordion, etc. 
It also provides built-in collapsible, closable, maximizable and minimizable behavior and other customized behavior. 
Panels can be easily embedded into any position of web page.   
  -->
<script type="text/javascript">
	$(function() {
	/*	
		// 设置panel的属性 $("#p").panel({....})
		$('#p').panel({
			width : 500,
			height : 150,
			title : 'My Panel',
			tools : [ {
				iconCls : 'icon-add',
				handler : function() {
					alert('new')
				}
			}, {
				iconCls : 'icon-save',
				handler : function() {
					alert('save')
				}
			} ]
		});

	*/
	});
</script>
</head>

<body>
	<!--  
		collapsible : 折叠 按钮	, 默认没有
		minimizable : 最小化 按钮, 默认没有
		maximizable : 最小化按钮
		closable	: 关闭按钮
		
		iconCls		: 图标, 请参考 themes/icon.css 中的图标
	-->
	<div id="p" 
		class="easyui-panel" 
		title="My Panel by class"
		style="width:500px;height:150px;padding:10px;background:#fafafa;"
		collapsible="true"
		minimizable="true"
		maximizable="true"
		closable="true"
		iconCls="icon-save"
	>
		<p>panel content.</p>
		<p>panel content.</p>
	</div>
	
	<!-- 
		调用panel的方法  $('#p').panel('methodName')
		隐藏后, 可以看见 dom结点灰显(Firebug中查看 display:none)	
	-->
	<!-- open -->
	<button id="openBtn" value="open">open</button>
	<script type="text/javascript">
		$("#openBtn").click(function(){
			$("#p").panel('open');
		});
	</script>
	<!-- close -->
	<button id="openBtn" value="close" οnclick="$('#p').panel('close')">close/hide</button>
	<!-- destroy -->
	<button id="openBtn" value="close" οnclick="$('#p').panel('destroy')">destroy</button>
	
	
	<!--  
  	<div id="p" style="padding:10px;">    
  		<p>panel content.</p>    
  		<p>panel content.</p>
  	</div> 
  -->




</body>
</html>


   

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值