Skip to content
Permalink
Browse files

sortable: don't call the base widget _setOption for disabled to avoid…

… the ui-state-disabled class being added. Fixes #5501 - sortable: disabled should not have the ui-state-disabled class
  • Loading branch information
rdworth committed Apr 9, 2010
1 parent ffc29bb commit 3291d3951ab177cde692f9c763248027b3c5a128
Showing with 14 additions and 1 deletion.
  1. +2 −1 tests/unit/sortable/sortable_methods.js
  2. +12 −0 ui/jquery.ui.sortable.js
@@ -84,7 +84,7 @@ test("enable", function() {
});

test("disable", function() {
expect(6);
expect(7);
el = $("#sortable").sortable({ disabled: false });
sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })');

@@ -97,6 +97,7 @@ test("disable", function() {
sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })');
el.sortable("option", "disabled", true);
equals(el.sortable("option", "disabled"), true, "disabled option setter");
ok(el.sortable("widget").is(":not(.ui-state-disabled)"), "sortable element does not get ui-state-disabled since it's an interaction");
sort($("li", el)[0], 0, 40, 0, '.sortable("option", "disabled", true)');

var expected = $('<div></div>').sortable(),
@@ -73,6 +73,18 @@ $.widget("ui.sortable", $.ui.mouse, {
return this;
},

_setOption: function(key, value){
if ( key === "disabled" ) {
this.options[ key ] = value;

this.widget()
[ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
} else {
// Don't call widget base _setOption for disable as it adds ui-state-disabled class
$.Widget.prototype._setOption.apply(self, arguments);
}
},

_mouseCapture: function(event, overrideHandle) {

if (this.reverting) {

2 comments on commit 3291d39

@jzaefferer

This comment has been minimized.

Copy link
Member

jzaefferer replied May 5, 2010

.apply(self should be .apply(this, as mentioned here: http://forum.jquery.com/topic/sortable-21-4-2010

@ornicar

This comment has been minimized.

Copy link
Contributor

ornicar replied May 5, 2010

I fixed it on my fork, and sent a pull request.

Please sign in to comment.
You can’t perform that action at this time.