Search code examples
angularkendo-ui-angular2

Documentation about kendo-angular-resize-sensor


We have many cases where we have to change kendo grid height when our container is resized. I have seen on npm package: @progress/kendo-angular-resize-sensor but i really don't see any documentation published.

Will be available in future? if yes when?

So thanks.


Solution

  • The top priority is to get the Grid to be responsive "by default". This includes automatic resizing and min-width settings for the columns.

    For the moment you can use the following snippet as a manual alternative to these features.

    @Component({
      template: `
        <kendo-grid
            [height]="gridHeight">
            ...
        </kendo-grid>
        <!-- An internal component that will soon go public -->
        <kendo-resize-sensor (resize)="resize()"></kendo-resize-sensor>
      `
    })
    export class AppComponent {
        public gridHeight: number = 300;
    
        public resize(): void {
          // The Grid height is actually applied to the content area, not as total
          // This is **a bug** that will be fixed soon.
          this.gridHeight = this.elementRef.nativeElement.offsetHeight - 100;
        }
    
        ...
    }
    

    We were hoping to keep the resize sensor as an implementation detail. Still, it might find use in client applications. We'll add documentation for it in the coming weeks.