angular6frontendangular-gridster2

Fix gridster container


I'm using angular-gridster2 in my angular 6 application. When ever I drag a grid, it is going beyond the container. I want to restrict the grid in moving out of my container.

I have tried giving gridType: 'fit'. but it is not working.


Solution

  • You can set gridType: GridType.Fixed

    And set maxCols and maxRows options to grid cols and grid rows value.

    this.options.maxCols = this.gridster.gridColumns.length;
    this.options.maxRows = this.gridster.gridRows.length;
    

    It is worked in my side.