|
366 | 366 | });
|
367 | 367 | });
|
368 | 368 | _.chain(elements).sortBy(function (x) { return x.i; }).each(function (i) {
|
369 |
| - self._prepare_element(i.el); |
| 369 | + self._prepare_element(i.el, this.opts); |
370 | 370 | });
|
371 | 371 | }
|
372 | 372 |
|
|
376 | 376 | this.container.append(this.placeholder);
|
377 | 377 | this.container.height((this.grid.get_grid_height()) * (this.opts.cell_height + this.opts.vertical_margin) - this.opts.vertical_margin);
|
378 | 378 |
|
379 |
| - var on_resize_handler = function () { |
| 379 | + var on_resize_handler = function (opts) { |
380 | 380 | if (self._is_one_column_mode()) {
|
381 | 381 | if (one_column_mode)
|
382 | 382 | return;
|
383 | 383 |
|
384 | 384 | one_column_mode = true;
|
385 | 385 |
|
386 | 386 | _.each(self.grid.nodes, function (node) {
|
387 |
| - if (!node.no_move && this.opts.draggable !== false) { |
| 387 | + if (!node.no_move && opts.draggable !== false) { |
388 | 388 | node.el.draggable('disable');
|
389 | 389 | }
|
390 |
| - if (!node.no_resize && this.opts.resizable !== false) { |
| 390 | + if (!node.no_resize && opts.resizable !== false) { |
391 | 391 | node.el.resizable('disable');
|
392 | 392 | }
|
393 | 393 | });
|
|
399 | 399 | one_column_mode = false;
|
400 | 400 |
|
401 | 401 | _.each(self.grid.nodes, function (node) {
|
402 |
| - if (!node.no_move && this.opts.draggable !== false) { |
| 402 | + if (!node.no_move && opts.draggable !== false) { |
403 | 403 | node.el.draggable('enable');
|
404 | 404 | }
|
405 |
| - if (!node.no_resize && this.opts.resizable !== false) { |
| 405 | + if (!node.no_resize && opts.resizable !== false) { |
406 | 406 | node.el.resizable('enable');
|
407 | 407 | }
|
408 | 408 | });
|
409 | 409 | }
|
410 | 410 | };
|
411 | 411 |
|
412 |
| - $(window).resize(on_resize_handler); |
413 |
| - on_resize_handler(); |
| 412 | + $(window).resize(on_resize_handler(this.opts)); |
| 413 | + on_resize_handler(this.opts); |
414 | 414 | };
|
415 | 415 |
|
416 | 416 | GridStack.prototype._update_styles = function (max_height) {
|
|
443 | 443 | return $(window).width() <= this.opts.min_width;
|
444 | 444 | };
|
445 | 445 |
|
446 |
| - GridStack.prototype._prepare_element = function (el) { |
| 446 | + GridStack.prototype._prepare_element = function (el, opts) { |
447 | 447 | var self = this;
|
448 | 448 | el = $(el);
|
449 | 449 |
|
|
577 | 577 | if (typeof options.max_height !== 'undefined') el.attr('data-gs-max-height', options.max_height);
|
578 | 578 | if (typeof auto_position !== 'undefined') el.attr('data-gs-auto-position', options.auto_position ? 'yes' : null);
|
579 | 579 | this.container.append(el);
|
580 |
| - this._prepare_element(el); |
| 580 | + this._prepare_element(el, options); |
581 | 581 | this._update_container_height();
|
582 | 582 | };
|
583 | 583 |
|
|
0 commit comments