Search and Top Navigation
#8000 open feature ()
Opened January 10, 2012 04:21PM UTC
Last modified March 16, 2013 07:12PM UTC
Sortable: Allow the dimensions of sortable items to be changed in a start event
Reported by: | ferdyp | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 2.0.0 |
Component: | ui.sortable | Version: | 1.8.16 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Because the 'start' event is triggered late, any changes to an elements height are not applied to the ui-sortable-helper, which at the time the event triggers has already been created.
Therefor you can not make changes to an elements height before dragging, as the helper will preserve the old height.
The issue is easily fixed by triggering the start-event before creating the helper.
Patch:
--- jquery.ui.sortable.js Tue Jan 10 17:12:25 2012
+++ jquery.ui.sortable.js Tue Jan 10 17:12:25 2012
@@ -126,5 +126,2 @@
- Call callbacks
- this._trigger("start", event, this._uiHash());
-
We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
@@ -211,2 +208,5 @@
this.overflowOffset = this.scrollParent.offset();
+
+ //Call callbacks
+ this._trigger("start", event, this._uiHash());
Attachments (0)
Change History (10)
Changed January 10, 2012 04:23PM UTC by comment:1
_comment0: | Can't edit my issue, but here is the patch in a decent format; \ {{{ \ --- jquery.ui.sortable.js Tue Jan 10 17:12:25 2012 \ +++ jquery.ui.sortable.js Tue Jan 10 17:12:25 2012 \ @@ -126,5 +126,2 @@ \ \ - //Call callbacks \ - this._trigger("start", event, this._uiHash()); \ - \ //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture \ @@ -211,2 +208,5 @@ \ this.overflowOffset = this.scrollParent.offset(); \ + \ + //Call callbacks \ + this._trigger("start", event, this._uiHash()); \ \ }}} \ → 1326701792496244 |
---|
Changed January 10, 2012 04:49PM UTC by comment:2
And a code example; http://jsbin.com/ivuwak/2
Note when dragging 'Item 2' it's height remains as it was, while it's childs have already been hidden.
Changed January 16, 2012 09:16AM UTC by comment:3
Of course an easier, safer and quicker fix would be to introduce a new beforeStart-event.
Changed May 08, 2012 07:44AM UTC by comment:4
Any feedback (or action) would be appreciatied.
Changed May 08, 2012 12:36PM UTC by comment:5
This seems like a potentially breaking change. It will be addressed in the rewrite.
Changed June 26, 2012 01:22AM UTC by comment:6
type: | enhancement → feature |
---|
Changed October 11, 2012 02:55PM UTC by comment:7
milestone: | 1.9.0 → 2.0.0 |
---|
Changed November 05, 2012 12:43PM UTC by comment:8
status: | new → open |
---|
Changed March 13, 2013 03:13AM UTC by comment:9
summary: | start-event is triggered too late → Sortable: Allow the dimensions of sortable items to be changed in a start event |
---|
Changed March 16, 2013 07:12PM UTC by comment:10
Here's a reduced test case against master: http://jsfiddle.net/tj_vantoll/Lwz7z/.
Can't edit my issue, but here is the patch in a decent format;