EasyUI Forum

General Category => Bug Report => Topic started by: alex.capurro on May 16, 2012, 12:12:47 AM



Title: collapsing panel when moving
Post by: alex.capurro on May 16, 2012, 12:12:47 AM
I would like to know if its possible to collapse a panel when the user begins to move it.

In this post (http://www.jeasyui.com/forum/index.php?topic=270.0) there is an example of hiding the panel contents when the user is dragging. I have tried modifying the example code pasted in this thread but i cant seem to make the panel collapse. Could someone suggest a way please?

All i would like to see is that when the user starts to drag the panel it should collapse. Doing this means the user can move the panels much more quickly and fluid since big panels with data can make the dragging movement very slow and in some cases not functional at all.

Thanks


Title: Re: collapsing panel when moving
Post by: stworthy on May 16, 2012, 02:07:46 AM
Why not override the dragging proxy, it is more useful and flexible.

Below code demonstrate the collapse and expand feature:
Code:
$('#pp').portal({
border:false,
fit:true
});
$('div.portal-p').each(function(){
var pp = $(this);
pp.panel('options').onMove = function(){
$(this).panel('expand'); // when moved expand the panel
};
pp.panel('panel').draggable({
onBeforeDrag:function(e){
e.data.startTop = $(this).position().top + $('#pp').scrollTop();
pp.panel('collapse'); // when start moving collapse the panel
}
});
});