fix grid initialization

This commit is contained in:
Pavel Reznikov 2014-12-19 17:37:44 -08:00
parent 1ed21714b0
commit 16884fdf20
2 changed files with 10 additions and 1 deletions

View file

@ -310,6 +310,7 @@ Changes
#### v0.2.2 (current development version)
- fix grid initialization
- add `cell_height`/`cell_width` API methods
- fix boolean attributes (issue #31)

View file

@ -352,8 +352,16 @@
}, this.opts.float, this.opts.height);
if (this.opts.auto) {
var elements = [];
this.container.find('.' + this.opts.item_class).each(function (index, el) {
self._prepare_element(el);
el = $(el);
elements.push({
el: el,
i: parseInt(el.attr('data-gs-x')) + parseInt(el.attr('data-gs-y')) * parseInt(el.attr('data-gs-width'))
});
});
_.chain(elements).sortBy(function (x) { return x.i; }).each(function (i) {
self._prepare_element(i.el);
});
}