BTMorton / angular2-grid

A drag/drop/resize grid-based plugin directive for angular2
https://bmorton.co.uk/angular/
MIT License
354 stars 159 forks source link

Grid not recalculating height #210

Open blubberbo opened 7 years ago

blubberbo commented 7 years ago

I am experiencing an issue with the grid not recalculating its height when an item is added, removed or moved and the number of rows should change. Unfortunately, my application is such that I cannot easily reproduce the issue in a public plunkr, but I have taken a series of screenshots (see below) to demonstrate the issue:

1) Items laid out in 2 rows: grid-height-1

2) 1 Item is dragged to a third row: grid-height-2

3) When that item is then dragged back to the second row, the grid height is not recalculated and, instead, the whitespace of the third row remains: grid-height-3

My grid config is as follows:

 'margins': [5],            
        'draggable': true,       
        'resizable': false,        
        'max_cols': 4,          
        'max_rows': 0,              
        'visible_cols': 0,         
        'visible_rows': 0,          
        'min_cols': 1,            
        'min_rows': 1,              
        'col_width': 2,           
        'row_height': 2,          
        'cascade': 'up',            
        'min_width': 50,         
        'min_height': 5,         
        'fix_to_grid': false,      
        'auto_style': true,       
        'auto_resize': true,      
        'maintain_ratio': false,    
        'prefer_new': true,        
        'limit_to_screen': true,   
        'zoom_on_drag':false

The correct and expected behavior can be seen here: https://bmorton.co.uk/angular/ although I cannot duplicate the behavior I am experiencing on that demo.

I am using Angular 2.0.1 and my version of Angular2-Grid is 2.0.1 as seen here: https://www.npmjs.com/package/angular2-grid

BTMorton commented 7 years ago

Hmm, that's an interesting one. I'll try to look into it further but when I try to reproduce your config on the demo I get very unusual results, which means there's probably more issues I need to look into...