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

add resize_widget_dimensions() to change widget dimensions after gridster initialization #336

Open hrosenbauer opened 10 years ago

hrosenbauer commented 10 years ago

(this is a updated version of my first pull-request - now in a separate branch) (this pull request is based on the discussion of https://github.com/ducksboard/gridster.js/pull/77 and the code of https://gist.github.com/OwlyCode/6421823 with small changes, so most of the credits go to https://github.com/OwlyCode)

This will add resize_widget_dimensions() to gridster.js which allows to resize the widget dimensions after initialization:

// initialize gridster with 200x200px widgets using a 5px margin
var gridster = $('.gridster ul').gridster({
    widget_base_dimensions: [200, 200],
    widget_margins: [5, 5]
}).data('gridster');

// resize the widgets to 300x300px and 10px margin
gridster.resize_widget_dimensions({
    widget_base_dimensions: [300, 300],
    widget_margins: [10, 10]
});

It's very useful to resize the dashboard when the browser window is resized.

skozz commented 10 years ago

+1

dlabaj commented 10 years ago

Exactly what we needed.

dlabaj commented 10 years ago

Found one potential issue. After the grid has been render to the DOM and is showing on the web page, I am listening for when the browser window is resized. If I set the max_cols value (in my case 2), and don't set autogrow_cols to true when all the widgets are moved to the first column, you can't move them back to the second column. Other than that everything else has been working great.

Misiu commented 10 years ago

:+1:

rgomesf commented 10 years ago

Nice feature!

ChristopheBelpaire commented 10 years ago

+1 !!

OleMchls commented 10 years ago

:+1:

Misiu commented 10 years ago

Any chances to have this pulled?

vampolo commented 9 years ago

Can this pull request be merged please ?

croeck commented 9 years ago

+1

KoltonG commented 9 years ago

Someone needs to get this merged! Its awesome!!

dsmorse commented 9 years ago

Looks great I merged it into my fork dsmorse/gridster.js

rlagkrdy commented 7 years ago

It's awesome!!, Thank U very much!!!!!! +100!!!