PDA

View Full Version : YAHOO.ext.resizeable



wos
16 Jan 2007, 7:57 AM
Hi there,

i was trying to playing with this component, and i wondering am i possible to do config on draggable or YAHOO.util.DD method such as setting constraintX ?

tryanDLS
16 Jan 2007, 8:08 AM
Refer to the doc http://yui-ext.com/deploy/yui-ext/docs/output/YAHOO.ext.Resizable.html
Every config option available is specified.

wos
16 Jan 2007, 4:56 PM
but how do i set Xcontraint to it? the config option seem does't provided that :cry:

Animal
17 Jan 2007, 1:49 AM
You have minWidth and maxWidth

uofmpike
17 Jan 2007, 3:42 PM
how would I go about getting the coordinates a resizable element was dragged to and sending them to the server?

tryanDLS
17 Jan 2007, 3:45 PM
Call getX(), getY() or getXY() on the underlying Element, then use asyncRequest to post those values to a server page.

JohnT
17 Jan 2007, 3:57 PM
wos' question was never answered. I also have the same question.

I also would like to know how to set constraints on the drag.


Animal: You have minWidth and maxWidth

That doesn't do it. It appears to set the min and max size for the element.

I am betting Jack has made a way for us to do this. Just gotta figure it out I suppose.

John T.

tryanDLS
17 Jan 2007, 4:11 PM
The .33 code is using YUI dragdrop. Look at their doc and see if they even support constraining it by x,y

JohnT
17 Jan 2007, 4:13 PM
They do.

This will do the trick:




myDdElem.setXConstraint ( 0 , 300 );



I , personally, do not know how to do this from my resizable object, however.

Thanks for responding.

John T

tryanDLS
17 Jan 2007, 4:28 PM
Well, I'm guessing here, but Resizable has a property (internal) called 'dd' which looks to be the YUI drapdrop object. My guess is you could do resizeObj.dd.setXConstraint().

Set a BP in Resizable and look at the dd property. If it's what I think it is, you should see all the methods/properties of the YUI drapdrop object. If not, step thru the code that initializes dd and see what happens in the YUI drapdrop code.

JohnT
17 Jan 2007, 4:40 PM
Sure thing, Tim. I will try. I am fairly new to all of this "professional javascript" that you guys are using, but I will try.

If you are correct, this should not be too difficult ( for you ) lol

I will report back with my test results.

Thanks for atending to this post.

JohnT

JohnT
17 Jan 2007, 7:37 PM
Two hours later:

I cannot figure this out.

I know somewhere along the lines resizable is creating a dd object, where I should be able to set the constraint , but cannot for the life of me find the correct breakpoint.

I did try though. Sorry.

If anyone can point me in the right direction, it sure would be appreciated.

Regards,

JohnT

JohnT
17 Jan 2007, 7:56 PM
Ok I found in the code where I think the resizable in tapping into the drag drop:



.
.
.

if(this.draggable){
this.dd = this.dynamic ?
this.el.initDD(null) : this.el.initDDProxy(null, {dragElId: this.proxy.id});
this.dd.setHandleElId(this.resizeChild ? this.resizeChild.id : this.el.id);
}



Would I be correct to think that adding:





if(this.draggable){
this.dd = this.dynamic ? this.el.initDD(null) : this.el.initDDProxy(null, {dragElId: this.proxy.id});

/* WOULD THIS DO THE TRICK ?? */

this.el.setXConstraint ( 0 , 300 );

this.dd.setHandleElId(this.resizeChild ? this.resizeChild.id : this.el.id);
}




I am hesitant about screwing with Jack's code, that is why I am asking here first.

JohnT
17 Jan 2007, 8:04 PM
This did the trick. I got lucky, and I SURE WOULD LOVE to know how to do this without modifying Jack's code, but this worked:




if(this.draggable){
this.dd = this.dynamic ? this.el.initDD(null) : this.el.initDDProxy(null, {dragElId: this.proxy.id});
this.dd.setHandleElId(this.resizeChild ? this.resizeChild.id : this.el.id);
this.dd.setXConstraint ( 0 , 300 );
}




Apparently, if the parameter "draggable" is true in Resizable, this code block is executed.

I wonder how to add this parameter "setXConstraint" to config????

That would be better than screwing with code code, wouldn't it?

JohnT
17 Jan 2007, 8:23 PM
Never mind, that last post is wrong!

I should have listened to you.

This worked equally well without touching the core code.




myResizableObj.dd.setXConstraint( 0 , 300 );




Forgive me, I am learning my way around. Thank you. I learned alot tonight.

JohnT.

tryanDLS
17 Jan 2007, 8:38 PM
You don't have to do it in Jack's code. After you create your resizeable obj you can call the method



myResizable = new Resizable(blah...)
myResizable.dd.setXConstraint(...)


That way it only applies to the object's you want it to, and you don't risk overwriting the change with the next version of the codebase.

JohnT
17 Jan 2007, 8:45 PM
Yes, Tim, you must have been typing as I was. See my reply just before yours.

Thanks so much man, I appreciate it. I am beginning to get the hang of this, and sure do appreciate advice from you experts.

LOL -- hey at least other other newbies can follow this post to see how to track down their own problems and find solutions, though, right?

This was a fantastic learning experience, I am not kidding. I get tempeted to put the cart before the horse and ask you things like, "HEY TIM how do I add my own setXConstraint to Resizable object so I can do it in the config??? " but I am sure that will come later.

I'll be posting soon with another question, I am sure! From all of us new guys, thanks again.

Regards,

John

wos
17 Jan 2007, 9:44 PM
thanks alot!!!