PDA

View Full Version : Programmatically changing a portlet's position



abcdef
17 Jun 2011, 2:48 PM
Is there a simple way to programmatically move a portlet's position? Thanks in advance..

skirtle
19 Jun 2011, 3:31 PM
What do you mean by portlet and position?

abcdef
6 Jul 2011, 7:41 AM
Oh I mean dragging a portlet from say 2nd row in 1st portal column to say 3rd in 2nd portal column. Basically, is there a way to programmatically simulate drag and drop on portlets?

skirtle
7 Jul 2011, 1:54 PM
From looking at the source code it doesn't look like it. Take a look at the notifyDrop() method of the portal. You could add something though. This might work as a starting point but really all I've done is copy bits of notifyDrop():


function movePortlet(portal, portlet, colIndex, positionIndex) {
var oldEl = portlet.el.dom;

oldEl.parentNode.removeChild(oldEl);

var col = portal.items.itemAt(colIndex);

col.insert(positionIndex, portlet);
col.doLayout();
}

abcdef
7 Jul 2011, 3:41 PM
Perfect. Thank you for your time!