]> source.dussan.org Git - jquery-ui.git/commitdiff
sortable: don't call the base widget _setOption for disabled to avoid the ui-state...
authorRichard D. Worth <rdworth@gmail.com>
Fri, 9 Apr 2010 18:43:44 +0000 (14:43 -0400)
committerRichard D. Worth <rdworth@gmail.com>
Fri, 9 Apr 2010 18:43:44 +0000 (14:43 -0400)
tests/unit/sortable/sortable_methods.js
ui/jquery.ui.sortable.js

index adccc8c87fde8c6ad97a5883aff9083d43216dde..c4b5cdc08ff433689bb8a28f7057c307dbeb1999 100644 (file)
@@ -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(),
index 28be062f667b74f5f3cee7479a6db16089d20a8f..0fa3a125340cc3508f09f343ed2c98d77d41a4c3 100644 (file)
@@ -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) {