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

Skip to content

Commit e24192b

Browse files
committed
update gridstack
1 parent 0f6ab48 commit e24192b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

gridstack.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,16 @@
352352
}, this.opts.float, this.opts.height);
353353

354354
if (this.opts.auto) {
355+
var elements = [];
355356
this.container.find('.' + this.opts.item_class).each(function (index, el) {
356-
self._prepare_element(el);
357+
el = $(el);
358+
elements.push({
359+
el: el,
360+
i: parseInt(el.attr('data-gs-x')) + parseInt(el.attr('data-gs-y')) * parseInt(el.attr('data-gs-width'))
361+
});
362+
});
363+
_.chain(elements).sortBy(function (x) { return x.i; }).each(function (i) {
364+
self._prepare_element(i.el);
357365
});
358366
}
359367

0 commit comments

Comments
 (0)