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

Skip to content

Commit ecebcc0

Browse files
committed
Merge pull request gridstack#132 from mgwidmann/sort_problem
Improper sorting with respect to nodes of variable widths
2 parents 310c854 + 5f2e795 commit ecebcc0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/gridstack.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,12 @@
429429

430430
if (this.opts.auto) {
431431
var elements = [];
432+
var _this = this;
432433
this.container.children('.' + this.opts.item_class).each(function (index, el) {
433434
el = $(el);
434435
elements.push({
435436
el: el,
436-
i: parseInt(el.attr('data-gs-x')) + parseInt(el.attr('data-gs-y')) * parseInt(el.attr('data-gs-width'))
437+
i: parseInt(el.attr('data-gs-x')) + parseInt(el.attr('data-gs-y')) * _this.opts.width // Use opts.width as weight for Y
437438
});
438439
});
439440
_.chain(elements).sortBy(function (x) { return x.i; }).each(function (i) {

0 commit comments

Comments
 (0)