#4186 closed bug (fixed)
Resizable: aspectRatio cannot be changed after initialization
Reported by: | tcarnell | Owned by: | Scott González |
---|---|---|---|
Priority: | major | Milestone: | 1.12.2 |
Component: | ui.resizable | Version: | 1.6rc6 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I have a resizable div, and want to change the 'aspectRatio' behaviour on the fly. Attempting the following code has no affect:
$("#myResizable).resizable('option', 'aspectRatio', newState);
(where 'newState' is either true|false)
The workaround is as follows, but I am concerned about the cost overhead:
$("#myResizable).resizable('destroy'); //re-initialize the resizable with the desired 'aspectRatio' value
Change History (14)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Milestone: | TBD → 1.6 |
---|---|
Priority: | major → critical |
comment:3 Changed 14 years ago by
Milestone: | 1.7 → 1.next |
---|---|
Priority: | critical → blocker |
comment:4 Changed 14 years ago by
I just ran into this issue myself. Here's a quick workaround if someone needs it (probably not the right way to really patch it, though):
(function() { // Work around http://dev.jqueryui.com/ticket/4186 var oldSetData = $.ui.resizable.prototype._setData; $.ui.resizable.prototype._setData = function(key, value) { oldSetData.apply(this, arguments); if (key === "aspectRatio") { this._aspectRatio = !!value; } }; })();
comment:6 Changed 12 years ago by
Milestone: | 1.next → 1.9 |
---|
comment:7 Changed 12 years ago by
Priority: | blocker → major |
---|
comment:9 Changed 12 years ago by
An updated workaround for recent versions of jQuery UI:
(function() { var oldSetOption = $.ui.resizable.prototype._setOption; $.ui.resizable.prototype._setOption = function(key, value) { oldSetOption.apply(this, arguments); if (key === "aspectRatio") { this._aspectRatio = !!value; } }; })();
comment:10 Changed 10 years ago by
Milestone: | 1.9.0 → 2.0.0 |
---|
comment:11 Changed 10 years ago by
Status: | new → open |
---|---|
Summary: | changing aspectRatio of resizable using 'option' feature after init does not work → Resizable: aspectRatio cannot be changed after initialization |
Verified that this is still an issue in 1.9.1 - http://jsfiddle.net/tj_vantoll/L4h3F/.
comment:13 Changed 6 years ago by
Keywords: | aspectRatio resizable option init removed |
---|---|
Milestone: | 2.0.0 → 1.12.2 |
Resolution: | → fixed |
Status: | open → closed |
Note: See
TracTickets for help on using
tickets.
(sorry) missed a closing double quote on the code samples above, should have been: