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

Template-based inconsistency / workarounds for dynamic object instantiation #383

Open madmonkey opened 10 years ago

madmonkey commented 10 years ago

First off - thank you for an awesome niche library; it fit our requirements perfectly. I found a few issues (not show stoppers by any means) while integrating this into my current project.

1) Moving from the javascript method to a more template-based approach revealed that the .addWidget function did not behave the same way as the template-based attributes - specifically when it came to row-height - I had to apply the data-sizey attribute on both the li and contained control. (I am uncertain if the js method does this behind the scenes)

*The workaround was to include data-sizey for the li and control

2) Using the .addWidget method I was able to directly place controls into gridster without using a corresponding li tag; using just the data-attributes/template it just wouldn't render.

*The workaround was to include the ul in the main area and surround the templates with the li tag.

3) My particular application allows the user to customize their own screens and as such I am not entirely certain what the min/max cols/rows would be as I just iterate over a controls collection.

I found using the templated approach didn't always resize or layout the controls correctly. If I returned the list of controls in mostly sorted order it was better but still offish.

Ultimately, setting a minCols and minRows seemed to buy enough 'breathing' room for the controls to layout appropriately.

*The workaround was to find a workable min number for both (in my cases 6 cols and 30 rows seemed to hit)

Let me know if you require any additional information.