I have the following code to create panel on the fly. Now I want to create panels on top of others. The following code replaces the existing panel.
<script type="text/javascript">
$(function(){
$('#pp').portal({
border:false,
fit:true
});
addpanel('dashboard', 'DASHBOARD');
});
function addpanel(link, title){
op = true;
remove();
var p = $('<div id="pgrid"><div/>').appendTo('body');
if(link=='dashboard'){ // Dashboard will not be closable
op = false;
}else{
op= true;
}
p.panel({
title:title,
href: 'views/'+link+'.php',
height:'750',
closable:op,
maximizable:true,
onClose:function(){
if(link!='dashboard'){
add('dashboard', 'DASHBOARD');
}
},
onMaximize: function(){
var opts = $(this).panel('options');
var p = $(this).panel('panel');
opts.fit = false;
opts.stub = $('<div></div>').insertAfter(p);
p.appendTo('body').css('position','').addClass('max');
$(this).panel('resize', {
width: $(window).width(),
height: $(window).height()
});
},
onRestore: function(){
var opts = $(this).panel('options');
var p = $(this).panel('panel');
p.insertAfter(opts.stub).removeClass('max');
opts.stub.remove();
p.parent().removeClass('panel-noscroll');
}
});
$('#pp').portal('add', {
panel:p,
columnIndex:1
});
$('#pp').portal('resize');
}
function remove(){
$('#pp').portal('remove',$('#pgrid'));
$('#pp').portal('resize');
}
</script>
<div id="pp" region="center">
<div style="width:15%; padding: 2px;">
<div title="User Profile" iconCls="icon-man" align="center"
closable="false" style="padding:4px;" href="navigation/profile.php">
</div>
</div>
<div style="width:85%; padding: 2px;">
<div id="pgrid" closable="true" maximizable="true"></div>
</div>
</div>
When I add a panel using
addpanel('link', 'Linkname')
, it remove the panel using the
function. But instead of removing the panel I want to add the panel on top of the existing one. So I removed the
function. But the
function appends the panel below the existing one. I want the new panel to be on top of the existing with the same position but higher z-index while the existing panel will be disabled until the top one is closed. Your help will be highly appreciated.