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

Change Gridster options on runtime #284

Open claravanstaden opened 10 years ago

claravanstaden commented 10 years ago

I'd like to change the Gridster options at runtime, but I run into some issues. Sometimes the options change, other times they don't. The options values are from input fields.

Am I doing something wrong?

gridster.options.widget_margins = [parseInt(margin_size),parseInt(margin_size)]; gridster.options.widget_base_dimensions = [parseInt(widget_size),parseInt(widget_size)]; gridster.generate_grid_and_stylesheet();

claravanstaden commented 10 years ago

Found it. Issue was related to Destroy/init stylesheet issue #227.

Fixed by adding Gridster.generated_stylesheets = []; to destroy().

asapach commented 10 years ago

@Clar64, could you please create a pull request?

ryancharlesking commented 10 years ago

It would probably be better to add that clearing of the generated stylesheets to the remove_style_tags function. That function is called in the destroy function anyway, but that way if the function is used on it's own, that cache will be cleared as well.

claravanstaden commented 10 years ago

I have more issues which I suspect comes from this issue. I have multiple gridster instances. When I destroy an instance, and create it again, the drag stop callback function does not get invoked anymore.