2.0.3 • Published 2 years ago

gridster-item-extend v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

gridster-item-extend

Extension of angular-gridster2 library.

Install

npm i gridster-item-extend

Angular v13.x support

Example

Without gridster-item-extend
normal gridster-item
With gridster-item-extend
auto gridster-item
  • gridster-item-extend Library can Auto update height and remove scroll.

How to use

Module import Declaration

  • src/app/app.module.ts
    @NgModule({
      imports: [
        GridsterItemExtendModule,
        GridsterModule
      ]
      ...
    })
    export class AppModule { }

    How to use in HTML files

    <gridster [options]="options">
      <gridster-item-extend [item]="item" *ngFor="let item of dashboard">
        <div>
          <h2>raj</h2>
        </div>
      </gridster-item-extend>
    </gridster>
  • src/app/app.component.ts

    import { GridsterItemExtendComponent } from 'gridster-item-extend';
    @ViewChildren(GridsterItemExtendComponent) gridstersItem : QueryList<GridsterItemExtendComponent>;
    
    ngOnInit(): void {
      this.options = {
        /* Default value : false;
        * If customLoadItems is not given then it will work as normal 
        * gridster-item component
        * 
        * If customLoadItems set to true then you can control loading of
        * gridster-item-extend component
        */
        customLoadItems: true,
        ....
        // Add more cols and rows so gridster can push down / shift other widgets
        minCols: 100,
        maxCols: 1000,
        minRows: 100,
        maxRows: 1000,
        ...
      }
    }
    ngAfterViewInit(){
        this.loadGridsterItemAutoHeight();
    }
    loadGridsterItem(){
      // child node list 
      this.gridsterItems.forEach(item=> {
        // call method to load gridster item
        item.loadCurrentGridsterItem()
      })
    }
    // Use this function call in/after ngAfterViewInit life cycle
    loadGridsterItemAutoHeight(){
      this.gridsterItems.forEach(item=> {
        // Child element height;
        const height = item.el.querySelector('div').offsetHeight;
        // setNewRow function calculate new rows for current item
        item.setNewRow(height);
        item.loadCurrentGridsterItem();
      })
    }

Browser support

What Angular supports here

License

The MIT License

Copyright (c) 2022 rajratna maitry

2.0.3

2 years ago

1.2.5

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago