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_widget setting col and row generates crash #412

Open
simplenotezy opened this issue Aug 12, 2014 · 4 comments
Open

add_widget setting col and row generates crash #412

simplenotezy opened this issue Aug 12, 2014 · 4 comments

Comments

@simplenotezy
Copy link

Hi there!

I have been fighting with a problem lately. Everything in gridster works. I can build up a very nice grid without problems. Then, when I save my grid in the database, and reload the page, it lags incredibly much. The more boxes, the more lag. It will cause the browser to crash. If theres few enough boxes, the page will load in 10-15 seconds, and then the grid will be perfect.

So I have spent hours narrowing down the problem, and I have found what causes this. When I import each grid box from the serialized data, I use this function:

add_widget(html, this.size_x, this.size_y, this.col, this.row); // this causes huge load time

If I remove this.col and this.row, it will load in less than a second:

add_widget(html, this.size_x, this.size_y); // this works perfectly

I am using version 0.5.5. Please note, that I have just upgraded from v0.5.1 where this issue did not exist. I think I remember it didn't work in 0.5.4 either.

I know you are super busy, but we're unable to launch our product, when we can't set col and row.

Thanks in advance!

@simplenotezy
Copy link
Author

I have solved the problem. Well, a quickfix. If I remove the col and row from add_widget, and then instead add it to the HTML like this:

var html = $(html).attr('data-row', this.getData().row).attr('data-col', this.getData().col);

It works perfectly! Hurray!!

@Chazmanian
Copy link

canfiax - can you provide a snippet of code that demonstrates your fix. Specifically, does the $(html) selector represent the return you received from the add_widget call? I might have to do something similar to what you have been doing - that is, save and then restore a layout and it would be helpful if you shared. Thanks.

@matheo
Copy link

matheo commented Sep 1, 2014

Cool, I'm about to work with many widgets and this is good to know. Would be good if the fix is documented properly 👍

@mobichel
Copy link

I faced with same issue after upgrading to Gridster 0.5.2.
Previously add_faux_rows() was called with undefined and we have no such problem.

Now add_faux_rows() method accepts size_y passed to add_widget() method. If you pass size_y as string it leads to incorrect calculation inside add_faux_rows() and your page become unresponsive.

Try to pass size_x and size_y as numbers when call add_widget method to solve this issue.

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

No branches or pull requests

4 participants