cssangular-gridster2

angular-gridster2 grid size


I am currently working on the integration of angular-gridster2. The goal is to get a grid with a fixed row height, fixed column count and the size should be calculated. This is my current GridsterConfig:

{
  setGridSize: true,
  margin: 5,
  displayGrid: DisplayGrid.OnDragAndResize,
  gridType: GridType.VerticalFixed,
  keepFixedHeightInMobile: true,
  fixedRowHeight: 50,
  minCols: 6,
  maxCols: 6,
  swap: true,
  pushItems: true,
  resizable: { enabled: true },
  draggable: {enabled: true },
  enableEmptyCellDrop: true,
}

With this config the grid height is calculates as expected (perfect). The problem is that the width stays the same after window resizing. When I set the setGridSize property to false the width calculation works as expected but the height is always 2 times the margin.


Solution

  • My solution now is that I have created a parent container div where I set the height depending on the grid rows (calculating the height with rows * (fixedRowHeight + margin).