EasyUI Forum
September 13, 2025, 09:56:24 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to add tool buttons on expandPanel in layout?  (Read 11621 times)
SeanHan
Newbie
*
Posts: 4


View Profile
« on: October 16, 2014, 12:13:51 AM »

anyone help?
Logged
SeanHan
Newbie
*
Posts: 4


View Profile
« Reply #1 on: October 20, 2014, 06:15:41 PM »

Dose this feature not supported in current version? Or any other ways to get it?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 on: October 20, 2014, 08:44:38 PM »

Any region panels accept the 'tools' property that allows you to add icons to the panel header.
Code:
	<div class="easyui-layout" style="width:700px;height:350px;">
<div title="West" style="width:100px;" data-options="
region:'west',
split:true,
tools:[{
iconCls:'icon-add'
}]"></div>
<div data-options="region:'center',title:'Main Title',iconCls:'icon-ok'">
</div>
</div>
Logged
SeanHan
Newbie
*
Posts: 4


View Profile
« Reply #3 on: October 20, 2014, 11:23:43 PM »

Any region panels accept the 'tools' property that allows you to add icons to the panel header.
Code:
	<div class="easyui-layout" style="width:700px;height:350px;">
<div title="West" style="width:100px;" data-options="
region:'west',
split:true,
tools:[{
iconCls:'icon-add'
}]"></div>
<div data-options="region:'center',title:'Main Title',iconCls:'icon-ok'">
</div>
</div>

Thanks for your reply, but your code only shows how to add icons on normal panel. I just don't know how to add these icons on expand panel when a panel hidden.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #4 on: October 21, 2014, 12:19:20 AM »

In the 'onCollapse' event, get the expanding panel and override the 'tools' property. Please refer the code below:
Code:
	<div class="easyui-layout" style="width:700px;height:350px;">
<div title="North" style="height:100px" data-options="
region:'north',
split:true,
onCollapse:onCollapse
"></div>
<div data-options="region:'center',title:'Main Title',iconCls:'icon-ok'">
</div>
</div>
<script type="text/javascript">
function onCollapse(){
var opts = $(this).panel('options');
var layout = $(this).closest('.layout');
var region = opts.region;
var p = layout.layout('panel', 'expand'+region.substr(0,1).toUpperCase()+region.substr(1));
var tools = p.panel('options').tools;
p.panel({
tools: [{
iconCls:'icon-add'
}].concat(tools.pop())
})
}
</script>
Logged
SeanHan
Newbie
*
Posts: 4


View Profile
« Reply #5 on: October 21, 2014, 06:36:42 PM »

In the 'onCollapse' event, get the expanding panel and override the 'tools' property. Please refer the code below:
Code:
	<div class="easyui-layout" style="width:700px;height:350px;">
<div title="North" style="height:100px" data-options="
region:'north',
split:true,
onCollapse:onCollapse
"></div>
<div data-options="region:'center',title:'Main Title',iconCls:'icon-ok'">
</div>
</div>
<script type="text/javascript">
function onCollapse(){
var opts = $(this).panel('options');
var layout = $(this).closest('.layout');
var region = opts.region;
var p = layout.layout('panel', 'expand'+region.substr(0,1).toUpperCase()+region.substr(1));
var tools = p.panel('options').tools;
p.panel({
tools: [{
iconCls:'icon-add'
}].concat(tools.pop())
})
}
</script>

Thank you very much!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!