EasyUI Forum
April 28, 2024, 12:24:20 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Panel onMove event does not fire.  (Read 28794 times)
tslatt
Jr. Member
**
Posts: 85



View Profile
« on: January 24, 2012, 08:19:43 AM »

See http://www.jeasyui.com/forum/index.php?topic=257.0

Bug:

The onMove event for a panel does not fire in easyUI 1.2.5. This was tested for panels that are within the portal layout. An alert was added to the panel onMove event, but the alert is never triggered when a panel is moved around within the portal.

Feature Request:

It would be helpful if there was an onBeforeMove event for panels for use within the portal layout. It has been found that when moving a panel within a portal, if that panel contains a great amount of data, such as a datagrid or a graph, the panel can lose focus when being dragged -- unless it is collapsed first. Having an onBeforeMove event for panels would allow us to collapse a panel before it's moved. Then, the onMove event, once it's working, could be used to re-expand the panel after it is moved.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: January 26, 2012, 03:02:06 AM »

The portal panel cannot trigger 'onMove' event. This bug has been fixed. Please download the portal plugin from http://www.jeasyui.com/extension/portal.php.

It has been found that when moving a panel within a portal, if that panel contains a great amount of data, such as a datagrid or a graph, the panel can lose focus when being dragged -- unless it is collapsed first.

To solve this issue, override the moving panel proxy may be helpful:
Code:
$('div.portal-p').each(function(){
$(this).panel('panel').draggable({
proxy:function(source){
var p = $('<div class="portal-proxy">proxy</div>').insertAfter(source);
p.width($(source).width());
p.height($(source).height());
p.html($(source).html());
p.find('div.panel-body').empty();
p.find('div.portal-p').removeClass('portal-p');
return p;
}

});
});
Logged
tslatt
Jr. Member
**
Posts: 85



View Profile
« Reply #2 on: January 26, 2012, 08:09:34 AM »

I downloaded the updated portal plugin, installed it, and tried again. The onMove function still does not trigger when a panel is moved.

I set up the panel events on each panel while they are in the staging area, before I add them to the portal, because for some unknown reason, doing it after they are in the portal makes them undraggable. All of the other events I've tried seem to be working normally, but even with the updated portal js, onMove still doesn't do anything.

Code:
//set up panel events for all panels in this tab, *before* adding them to the portal (doing it after breaks dragging in the portal)
$('#' + pID + uID).next(".staging").find(".easyui-panel").each(function(index) {//for all panels in the staging area
  $(this).panel({//for this panel

    onLoad: function() {//do this when a panel's href is loaded (ajax)
      //my actions here...
    },//end on panel ajax load

    onOpen: function() {//do this on panel open
      //my actions here...
    },//end on panel open

    onClose: function() {//do this on panel close
      //my actions here...
    },//end on panel close

    onCollapse: function() {//do this on panel expand
      //my actions here...
    },//end on panel collapse

    onExpand: function() {//do this on panel expand
      //my actions here...
    },//end on panel expand

    onMaximize: function() {//do this on panel maximize
      //my actions here...
    },//end on panel maximize

    onRestore: function() {//do this on panel restore (unmaximized)
      //my actions here...
    },//end on panel restore (unmaximized)

    onMove: function(left, top) {//do this on panel move
      alert("moved");
    },//end on panel move

    onResize: function(width, height) {//do this on panel resize
      //my actions here...
    }//end on panel resize

  });//end for this panel
});//end for all panels
//end add events to all panels
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: January 26, 2012, 06:03:56 PM »

After recreate panel, call 'enableDragging' method for that panel again:
Code:
$(this).panel({
...
});
$('#pp').portal('enableDragging',$(this));  // enable the dragging feature for panel
Logged
tslatt
Jr. Member
**
Posts: 85



View Profile
« Reply #4 on: January 27, 2012, 08:04:19 AM »

That worked for getting the onMove to work. Adding that drag enabling bit after setting up the panel events allowed me to do the panel event setup *after* the panels are added to the portal, rather than before. Then, the onMove event would fire.

Thanks!!!!
Logged
alex.capurro
Newbie
*
Posts: 25


View Profile Email
« Reply #5 on: May 14, 2012, 08:47:32 AM »

I would still like to know if its possible to collapse the panel when the user begins to move it. 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?

Thanks
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!