Saturday, March 24, 2012

Mystery of the Un-positionable DragPanel!

I am creating a portal page for my company's intranet, a la Google homepage. Since DropZones seem like such a pain to work with, I decided to take a different approach to the widget movement, and use Javascript. My idea requires that I move a Panel (which also happens to be the subject of the DragPanelExtender) using "Style:top" and "Style:left". The problem is, I can't seem to get this to work, no matter how I form the line.

 function adjustToColumn(e){
//get location var widg= getWholeWidgetOnDrop(e); var location= $common.getLocation(widg); x= location.x; y= location.y; alert(x +"," + y);
//set location

//widg.style("top","100px"); //, "100px");
//widg.Attributes.CssStyle.Add("top", "100px");
}

 
In the above code, 'getWholeWidgetOnDrop' returns the outermost panel containing the entire widget.
The 'get' portion of this code works just fine.
However, no matter how I form the 'set' portion, I always seem to get an error.
I've tried widg.Attributes.Style.Add, widg.Attributes.Add, among countless others, and they always come back
saying that either 'Attributes... is null or not a method" or "Object does not have this method or property"
I'm all out of ideas! 
 Help please?!Big Smile 

Hello,

Use the Javascript debugger in your set call with the line 'debugger;'.

Then, add the widg variable to the watch window. I believe you will need 'widg.style.top'. Check out jquery as well for manipulating dom objects.

Regards,

Louis


Thanks for the reply.

I tried widg.style.top, and unfortunately it didn't work either...

However, this morning, I ran across another command that DID work. I used Sys.UI.DomElement.setLocation(element, x, y) ; This worked like a CHAMP. Supposedly, you can abbreviate this by using $common.setLocation(element, x, y); but for some reason or the other, this didn't work for me.

I appreciate the help, though!

--Dustin

No comments:

Post a Comment