Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

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

wants to merge 20 commits into from

Conversation

hrosenbauer
Copy link
Contributor

(this is a updated version of my first pull-request - now in a separate branch)
(this pull request is based on the discussion of #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.

resize widgets after initialization
@skozz
Copy link

skozz commented Apr 1, 2014

+1

@hrosenbauer hrosenbauer changed the title add resize_widget_dimension() add resize_widget_dimensions() to change widget dimensions after gridster initialization Apr 1, 2014
@dlabaj
Copy link

dlabaj commented Apr 4, 2014

Exactly what we needed.

@dlabaj
Copy link

dlabaj commented Apr 7, 2014

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.

remove min-width and min-height after stopping resize
@Misiu
Copy link

Misiu commented Apr 16, 2014

👍

@rgomesf
Copy link

rgomesf commented May 9, 2014

Nice feature!

hrosenbauer and others added 18 commits June 16, 2014 16:59
$body won't receive mouseup if the cursor is outside the browser window, $document does
when the scrollX/Y is changed during drag (e.g. by the mousewheel)
the offset wasn't correct
window.scrollX/Y is only available in Chrome, not in IE
Useful to use them when we there is no gridster instance, like sorting
a previously stored output from the serialize method.
Useful when using `positionschanged` event, fired before gridster
instance is cached.
resize widgets after initialization

Conflicts:
	src/jquery.gridster.js
remove min-width and min-height after stopping resize
…r/gridster.js into resize-widget-dimensions

Conflicts:
	src/jquery.gridster.js
@ChristopheBelpaire
Copy link

+1 !!

@OleMchls
Copy link

👍

@Misiu
Copy link

Misiu commented Jul 29, 2014

Any chances to have this pulled?

@vampolo
Copy link

vampolo commented Oct 6, 2014

Can this pull request be merged please ?

@croeck
Copy link

croeck commented Nov 10, 2014

+1

@KoltonG KoltonG mentioned this pull request Dec 24, 2014
@KoltonG
Copy link

KoltonG commented Dec 27, 2014

Someone needs to get this merged! Its awesome!!

@dsmorse
Copy link

dsmorse commented Apr 8, 2015

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

@rlagkrdy
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.