ducksboard / gridster.js

gridster.js is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns
http://gridster.net/
MIT License
6.03k stars 1.2k forks source link

Problem when resizing and adding new widgets #196

Closed thoma202 closed 11 years ago

thoma202 commented 11 years ago

Hi,

I tried this on the demo version.

Follow this : $widget = gridster.add_widget('

  • ', 4, 3) $widget =gridster.resize_widget($widget , 6, 1) gridster.add_widget('
  • ', 1, 1); gridster.add_widget('
  • ', 1, 1); gridster.add_widget('
  • ', 1, 1);

    When you do that, then the grid get broken and new widget go to the right and not as expected in the grid !

    MartinWeise commented 11 years ago

    I think this is caused by the auto placement from gridster. Btw you need HTML Markup in the gridster.add_widget("

  • Markup here
  • ", sizex, sizey); - function.

    So, when the grid registers the widget, you need to change the "data-col"-attribute. Gridster.js does the rest for you (replacing immediatly)

    Code would be like:

    var gridster = $(".gridster ul").gridster().data('gridster'); $('.trigger').click(function() { var e = gridster.add_widget('

  • My new widget
  • ', 1, 1); // (html, sizex, sizey) e.data('col',3); // (attr, column_widget_should_be) });

    Untested, but it should work, Have a nice evening from Austria!

    baiiko commented 11 years ago

    Hi,

    I have same bugs.

    With the settings, i can change the size widget. After my resize the gridmap is different.

    Steps :

    1. I just add two widgets.
    2. After, i change the size of first widget to max-width.

    Screens :

    before :

    image

    after :

    image

    vieron commented 11 years ago

    Fixed here 195295be