Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ad40cd

Browse files
committed
improve nodes sorting
1 parent c797848 commit 6ad40cd

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

gridstack.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,10 @@
384384

385385
one_column_mode = true;
386386

387+
self.grid._sort_nodes();
387388
_.each(self.grid.nodes, function (node) {
389+
self.container.append(node.el);
390+
388391
if (!node.no_move) {
389392
node.el.draggable('disable');
390393
}
@@ -498,14 +501,6 @@
498501
self.container.trigger('change', [self.grid.get_dirty_nodes()]);
499502

500503
self.grid.end_update();
501-
502-
self.grid._sort_nodes();
503-
setTimeout(function() { //if animating, delay detaching & reattaching all elements until animation finishes
504-
_.each(self.grid.nodes, function (node) {
505-
node.el.detach();
506-
self.container.append(node.el);
507-
});
508-
}, (self.opts.animate ? 300 : 0));
509504
};
510505

511506
el.draggable({
@@ -669,12 +664,6 @@
669664
self.container.trigger('change', [self.grid.get_dirty_nodes()]);
670665

671666
self.grid.end_update();
672-
673-
self.grid._sort_nodes();
674-
_.each(self.grid.nodes, function (node) {
675-
node.el.detach();
676-
self.container.append(node.el);
677-
});
678667
};
679668

680669
GridStack.prototype.resize = function (el, width, height) {

0 commit comments

Comments
 (0)