Skip to content

Commit c42e39c

Browse files
author
Michael Hoffmann
committed
Change sortable selector and add full width drag item
1 parent dec1b3a commit c42e39c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

webroot/js/app/components/SortableComponent.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ App.Components.SortableComponent = Frontend.Component.extend({
33
startup: function() {
44
},
55
initSortableLists: function($dom) {
6-
$dom.find('table.sortable-list tbody').sortable().disableSelection();
7-
$dom.find('table.sortable-list tbody').on("sortupdate", this._onSortUpdate.bind(this));
6+
$dom.find('tbody.sortable-list').sortable({helper: this._fixWidthHelper}).disableSelection();
7+
$dom.find('tbody.sortable-list').on("sortupdate", this._onSortUpdate.bind(this));
88
},
99
_onSortUpdate: function(e, ui) {
1010
var foreignKey = ui.item.data('entity-id');
@@ -30,5 +30,11 @@ App.Components.SortableComponent = Frontend.Component.extend({
3030
alert("Error on update sort order! Please reload page.");
3131
}
3232
}.bind(this));
33+
},
34+
_fixWidthHelper:function(e, ui) {
35+
ui.children().each(function() {
36+
$(this).width($(this).width());
37+
});
38+
return ui;
3339
}
3440
});

0 commit comments

Comments
 (0)