]> source.dussan.org Git - jquery-ui.git/commitdiff
sortable: Fixed the floating functional demo, implemented forcePlaceholderSize
authorPaul Bakaus <paul.bakaus@googlemail.com>
Tue, 16 Sep 2008 12:40:48 +0000 (12:40 +0000)
committerPaul Bakaus <paul.bakaus@googlemail.com>
Tue, 16 Sep 2008 12:40:48 +0000 (12:40 +0000)
demos/functional/templates/ui.sortable.ex3.html
demos/functional/templates/ui.sortable.html
tests/sortable.js
ui/ui.sortable.js

index 1d460fd016959b608f3f3c8f710d5d7b75c68b96..e6fe28ee7c6e2082a5756531555e8c508aef1d23 100644 (file)
@@ -3,13 +3,17 @@
        <div id="example3">
                
                <div style="min-height: 50px; min-height:50px; height:auto !important;">
-               
+                       <style type="text/css" media="screen">
+                               #placeholderSortable li {
+                                       float: left;
+                               }
+                       </style>
                        <ul id="placeholderSortable" style="list-style-position: inside; height: 30px; cursor: hand; cursor: pointer;">
-                               <li id='user_Jack' style="float: left;">Jack</li>
-                               <li id='user_John' style="float: left;">John</li>
-                               <li id='user_Marry' style="float: left;">Marry</li>
-                               <li id='user_Claire' style="float: left;">Claire</li>
-                               <li id='user_Daniel' style="float: left;">Daniel</li>
+                               <li id='user_Jack'>Jack</li>
+                               <li id='user_John'>John</li>
+                               <li id='user_Marry'>Marry</li>
+                               <li id='user_Claire'>Claire</li>
+                               <li id='user_Daniel'>Daniel</li>
                        </ul>
                
                </div>
index 55ea4b7a68bb0c2bcc66c29ba06d5c18a81b8b13..79cfadbfba2d6a1101fb14fc65666e07445d2ee7 100644 (file)
@@ -38,7 +38,7 @@
                                options: [
                                        {
                                                desc: 'Floating, with defined placeholder class',
-                                               source: '$("#placeholderSortable").sortable({ placeholder: "ui-selected", revert: true });'
+                                               source: '$("#placeholderSortable").sortable({ placeholder: "ui-selected", forcePlaceholderSize: true, revert: true });'
                                        }
                                ]
                        }
index 99c4463e5cf299c4451fe33fa0cc3664aade51c9..7b79311a7d498e021a06effc7df1e8dabfa741b0 100644 (file)
@@ -109,7 +109,7 @@ test("disable", function() {
 test("defaults", function() {\r
        el = $("#sortable").sortable();\r
 \r
-       equals(el.data("helper.sortable"), "clone", "helper");\r
+       equals(el.data("helper.sortable"), "original", "helper");\r
        equals(el.data("tolerance.sortable"), "guess", "tolerance");\r
        equals(el.data("distance.sortable"), 1, "distance");\r
        equals(el.data("disabled.sortable"), false, "disabled");\r
index fd69b78e805af4f63b980d61e7826815fdaad56d..2ec6291de899f8bba663ed688e62c37d4b4e5c87 100644 (file)
@@ -302,9 +302,9 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
                                        return el;
                                },
                                update: function(container, p) {
-                                       if(className) return;
-                                       if(!p.height()) { p.height(self.currentItem.innerHeight()); };
-                                       if(!p.width()) { p.width(self.currentItem.innerWidth()); };
+                                       if(className && !o.forcePlaceholderSize) return;
+                                       if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0) - parseInt(self.currentItem.css('paddingBottom')||0)); };
+                                       if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0) - parseInt(self.currentItem.css('paddingRight')||0)); };
                                }
                        };
                }