Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit d151ca3

Browse files
committed
added ui-preserve-size option
1 parent 17c4158 commit d151ca3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/sortable.js

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ angular.module('ui.sortable', [])
1818
scope: {
1919
ngModel:'=',
2020
uiSortable:'=',
21+
uiPreserveSize: '=uiPreserveSize',
2122
////Expression bindings from html.
2223
create:'&uiSortableCreate',
2324
// helper:'&uiSortableHelper',
@@ -480,6 +481,16 @@ angular.module('ui.sortable', [])
480481
return function (e, item) {
481482
var oldItemSortable = item.sortable;
482483
var index = getItemIndex(item);
484+
485+
if (typeof scope.uiPreserveSize === 'boolean' && scope.uiPreserveSize !== false) {
486+
item.children().each(function () {
487+
var $el = angular.element(this);
488+
489+
// Preserve the with of the element
490+
$el.width($el.width());
491+
});
492+
}
493+
483494
item.sortable = {
484495
model: ngModel.$modelValue[index],
485496
index: index,

0 commit comments

Comments
 (0)