Skip to content

Conversation

Blackbaud-StewartStephens

Hello, I'm working on a modification of this project which will enable some gridster items to have a flexible height, based on the size of their contents. I know that flexible item sizes is on your roadmap, so I was hoping you could look over my approach and provide some feedback.

Currently, cell height is computed by the cell width multiplied by a specified ratio, and every row is the same height. With my change, a row's height is computed in one of two different ways:

  1. If there are no variable height items in a cell in the row, the cell height is computed in the same way that it is currently computed.
  2. If there is a variable height item in a cell in the row, the height of the row is computed by taking the height of the variable height item's content and dividing it by the height of the item. For example, a variable height item with height 3 and content height 450px will cause the 3 rows that it spans to each be 150px in height.

Items which are not variable height expand to fit their cells as expected.

I did a quick update to the demo, but I wound up breaking scrolling somehow. Also, I did not implement variable width, and I did not test with horizontal direction, since neither of those are requirements for my current project.

Thank you for your time.

@swiety85
Copy link
Owner

swiety85 commented Jul 28, 2018

Hi,
Do you mean the following point in the roadmap: "New GridsterItem option to dynamically calculate and apply height/width of the item that the content will not have to be scrolled"?
You approach is different and interesting, but I found a couple of problems:

  • resizing vertically does not work
  • finding the position for second and every next row of items is broken - create vertical space between items even if floating is on true
  • item margins does not work

I already started providing a similar solutions (#78) but had not enough time to finish it. In the end, my idea to solve this problem is to have a directive: #138. This approach seems to not interfere so much in the core of gridster and I think in the end will be less problematic.
Never the less I will consider your code while implementing the directive. Or maybe you want to do it? ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants