Skip to content

Loading…

fix destroy function #78

Merged
merged 2 commits into from

3 participants

@chrjean
  • in jQuery UI 1.10.0 the destroy function is renamed in _destroy
  • removing the useless .unbind(".nestedSortable") call
  • add the removeData("ui-sortable") call to remove the remaining "ui-sortable" data
  • replace namespace for removeData (from nestedSortable to mjs-nestedSortable)
danielevans and others added some commits
@danielevans danielevans Fix depedence on now-private method 21f0545
Christophe Jean fix destroy function
- in jQuery UI 1.10.0 the destroy function is renamed in _destroy
- removing the useless .unbind(".nestedSortable") call
- add the removeData("ui-sortable") call to remove the remaining
"ui-sortable" data
- replace namespace for removeData (from nestedSortable to
mjs-nestedSortable)
47bbd2e
@mjsarfatti mjsarfatti merged commit d3a5c39 into mjsarfatti:2.0alpha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 21, 2013
  1. @danielevans

    Fix depedence on now-private method

    danielevans committed with Christophe Jean
  2. fix destroy function

    Christophe Jean committed
    - in jQuery UI 1.10.0 the destroy function is renamed in _destroy
    - removing the useless .unbind(".nestedSortable") call
    - add the removeData("ui-sortable") call to remove the remaining
    "ui-sortable" data
    - replace namespace for removeData (from nestedSortable to
    mjs-nestedSortable)
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 8 deletions.
  1. +16 −8 jquery.mjs.nestedSortable.js
View
24 jquery.mjs.nestedSortable.js
@@ -13,6 +13,10 @@
(function($) {
+ function isOverAxis( x, reference, size ) {
+ return ( x > reference ) && ( x < ( reference + size ) );
+ }
+
$.widget("mjs.nestedSortable", $.extend({}, $.ui.sortable.prototype, {
options: {
@@ -68,9 +72,13 @@
destroy: function() {
this.element
- .removeData("nestedSortable")
- .unbind(".nestedSortable");
- return $.ui.sortable.prototype.destroy.apply(this, arguments);
+ .removeData("mjs-nestedSortable")
+ .removeData("ui-sortable");
+ return $.ui.sortable.prototype._destroy.apply(this, arguments);
+ },
+
+ _destroy: function() {
+ return this.destroy();
},
_mouseDrag: function(event) {
@@ -222,7 +230,7 @@
var newList = document.createElement(o.listType);
this.beyondMaxLevels = 0;
-
+
// mjs - if the item is moved to the left, send it one level up but only if it's at the bottom of the list
if (parentItem != null && nextItem == null &&
(o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth()) ||
@@ -312,9 +320,9 @@
var half = this.options.isTree ? .8 : .5;
- var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height*half), item.height),
- isOverTopHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top - (item.height*half), item.height),
- isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
+ var isOverBottomHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height*half), item.height),
+ isOverTopHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top - (item.height*half), item.height),
+ isOverRightHalf = isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
verticalDirection = this._getDragVerticalDirection(),
horizontalDirection = this._getDragHorizontalDirection();
@@ -477,7 +485,7 @@
if (this.options.listType) {
var list = item.closest(this.options.listType);
- while (list && list.length > 0 &&
+ while (list && list.length > 0 &&
!list.is('.ui-sortable')) {
level++;
list = list.parent().closest(this.options.listType);
Something went wrong with that request. Please try again.