-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 bug #20
Comments
Can you give a sample? |
I have used the demo html and added the following script and a button. <input id="add_widget" type="button" value="Add Widget" style="color:#000"/> <script type="text/javascript">
$(function() {
$('.grid-stack').gridstack({
width: 12,
height:10,
cell_height: 50,
vertical_margin: 5,
});
});
$('#add_widget').click(function(){
var el = $.parseHTML("<div><div class=\"grid-stack-item-content\"/><div/>");
var grid = $('.grid-stack').data('gridstack');
grid.add_widget(el, 1, 1, 4, 1, true);
});
</script> If i keep clicking the add_widget button, the widgets continue to get added beyond the max number of rows. |
http://screencast.com/t/IGZ9txKZYh Notice that the first item is added on the right and its bigger than the max _width defined. While the last item that is added at the bottom is also beyond the height limit. |
Thank you for feedback. I will check auto positioning. Also I will add a method which will help to check if a widget could be added with respect to vertical constraint. I don't think that |
If height is not explicitly defined then the height property should not be restrictive. But if someone has defined the height then the add_widget should definitely restrict or at least warn the user that the new widget is being added beyond the set width / height restrictions. |
I've fixed the bug with auto-positioning. I've also added a new method |
Thank you :) |
While adding a widget, the constraints of the grid (width and height) are not respected.
The text was updated successfully, but these errors were encountered: