ManifestWebDesign / angular-gridster

An implementation of gridster-like widgets for Angular JS
http://manifestwebdesign.github.io/angular-gridster/
MIT License
964 stars 394 forks source link

Toggle item visibility #458

Open amergin opened 7 years ago

amergin commented 7 years ago

Would it be possible to toggle the visibility of grid items? Say that I have different type of items displayed in the grid, and I'd like to have a radio button for switching between the item types displayed within the grid. Any ideas how to achieve this?

amergin commented 7 years ago

The easy workaround for this is to just use ng-hide on the ng-repeat element. The problem with this approach is that this does not modify the existing grid layout. The ideal situation would be that once the item has been hidden, the layout algorithm is retriggered (any way to force this) and any of the above items are floated to take the hidden item's place.

samal-rasmussen commented 7 years ago

Use ng-if. It removes the element from the DOM.

ng-show only sets the the css display attribute to none on the element.