angular-deckgrid icon indicating copy to clipboard operation
angular-deckgrid copied to clipboard

Feature Request: Balanced Column Height

Open rjschie opened this issue 10 years ago • 2 comments
trafficstars

When a column has items that are shorter than another columns' items this can cause the entire column's height to be drastically shorter than the other columns'.

In Salvattore, a fix was done utilizing a better algorithm. If anyone would like to take a look at that and try to work something out, this would be an immensely helpful feature. That was on Pull Request #70

Here's an image as an example, and an example page: 1

rjschie avatar Mar 08 '15 03:03 rjschie

Okay. I understand. It's a little bit omplicated to implement this feature. You have to get the height before the element are rendered. Or you can render, get the height and rerender. But this is really dirty solution.

Citrullin avatar May 04 '15 18:05 Citrullin

I met the same problem, the general solution may be complex.But if you use deckgrid+ngInfiniteScroll, then I hope the answer can help you.

first, I fork symrad/angular-deckgrid to solve the redraw problem as issue#68 mentioned;then, I can get old column height to decide how to distribute new items.

The idea is : I calculate the max column height and min column height, if (maxColumn.height - minColumn.height) > 600(an arbitrary value), then distribute the first new item to min column and the rest is do as usual. This simple method keep the columns won't always be unbalanced.

Here's my source code

pheye avatar Mar 12 '17 12:03 pheye