gridster.js
gridster.js copied to clipboard
reinitialize grid for dynamical widgets.
so i found out what i wanted to tell you in the other post, i added a
this.init();
at row 1013 (in my copy of the file) just before
return $widget;
it reinitializes the grid after repositioning a dynamically added widget, so it wont crash the grid after certain movements.
Alright, go ahead and try it without the change. I updated the code that added dynamic widgets because of all sorts of data bugs.
On my production application, I don't have any problem with positioning dynamically added widgets.
Let me double check though, I may have made a new function.
Looks like I updated add_widget.. see if it works for you. If not I'll update the code. :)
nope, doesnt work, additionally it seems that when i have a widget and there is a widget below it, and i drag it, and move the mouse downwards it will push the widget below down and down and down everytime it collides with the widget below, and when it hits the browser bottom it crashes and puts all widgets to row 1. wow what the hell did i screw up here :/
Nothing that can't be fixed. :)
Try adding the config option that prevents larger widgets from moving down.
It's in the readme.
On Thursday, February 28, 2013, Frederik Reich wrote:
nope, doesnt work, additionally it seems that when i have a widget and there is a widget below it, and i drag it, and move the mouse downwards it will push the widget below down and down and down everytime it collides with the widget below, and when it hits the browser bottom it crashes and puts all widgets to row 1. wow what the hell did i screw up here :/
— Reply to this email directly or view it on GitHubhttps://github.com/dustmoo/gridster.js/issues/1#issuecomment-14264952 .
This is the option you need:
$.gridster({
shift_larger_widgets_down: false
});
I'll add the reinit script. I see the problem with the widgets not shifting up. (without the above option) but I need to look into it further.
The above option basically makes it so that larger widgets will swap with smaller widgets, but not the other way around. It works better with the swapping system.
Also, my lines are different, what function was that amended too?
here play around a bit with my test, and see if it works to your liking. https://dl.dropbox.com/u/2863238/gridster/gridster_dustmoo.html
Right, I see the problem.
If you wouldn't mind sending me a link to a zip of that demo, I'll play around and see if I can fix the behavior of the script.
Also, try it with the option above.
Thanks.
i added the option you mentioned above, it killed the ability to move stuff at all haha :8ball:
here's the zip, dont wonder about the css tho, it contains stuff from the gridster homepage, i didnt really work around yet because i was more or less just testing out so far.
https://dl.dropbox.com/u/2863238/gridster/gridster_dustmoo.zip
btw i more or less accidently added you on skype.
Great! I am near Seattle and gotta end for the day. And am pretty tied up throughout the weekend.
I'll go ahead and spend some time on this on Monday and see what I can do. This use case gives me some ideas on how to update the library. But alas, it isn't ready yet.
Based on what I figure out Monday we can schedule a Skype for sure. Germany right?
sure we can, yeah i am from germany and the time difference is a good thing because "i dont have time on monday" only counts for my timeframe and work hours ;)
Fixed your whitespace issue. It should work better for your project now. :)
I had some similar issues with resizing widgets and fixed them without having to do .init() which is very slow. This relates to ducksboard version, but hopefully can be fixed in the dustmoo version as well.
inside of fn.add_faux_cols , find the following line: var max_cols = actual_cols + (cols || 1);
add this line directly BELOW it: if (max_cols > this.max_cols) { return this; }
inside of fn.generate_grid_and_stylesheet , find the following line: this.cols = Math.max(min_cols, cols, this.options.min_cols);
add this line directly BELOW it: this.max_cols = this.cols;
inside of fn.resize_widget , find the following line: return $widget;
add this line directly ABOVE it: this.set_dom_grid_height();
This combination seems to have fixed my issue and should resolve this issue as well.
Thanks for your contribution, I'll incorporate then ASAP.
On Sat, May 4, 2013 at 12:06 AM, bompus [email protected] wrote:
I had some similar issues with resizing widgets and fixed them without having to do .init() which is very slow. This relates to ducksboard version, but hopefully can be fixed in the dustmoo version as well. inside of fn.add_faux_cols , find the following line: var max_cols = actual_cols + (cols || 1); add this line directly BELOW it: if (max_cols > this.max_cols) { return this; } inside of fn.generate_grid_and_stylesheet , find the following line: this.cols = Math.max(min_cols, cols, this.options.min_cols); add this line directly BELOW it: this.max_cols = this.cols; inside of fn.resize_widget , find the following line: return $widget; add this line directly ABOVE it: this.set_dom_grid_height();
This combination seems to have fixed my issue and should resolve this issue as well.
Reply to this email directly or view it on GitHub: https://github.com/dustmoo/gridster.js/issues/1#issuecomment-17429055
any update for this issue?