Set P-Tree height based on available screen height

UI Components for Angular
PhilHuhn
Posts: 177
Joined: 19 Sep 2018, 02:52
Location: Ann Arbor, Michigan USA
Contact:

13 Jun 2021, 14:50

Hey,
Yeah basically. You may be able to use ElementRef.nativeElement instead of ViewChild to calculate the tree component:

Code: Select all

import { Component, OnInit, OnDestroy, AfterViewInit, ElementRef } from '@angular/core';
...
	nav: HTMLSelectElement;
	...
	constructor(
		...
		private _elementRef: ElementRef ) { }
	...
	ngAfterViewInit() {
		this.nav = this._elementRef.nativeElement.querySelector('#nav');
		...
	}
The HostListener resize event allow one to handle adjusting the browser size and will be an excellent way to test the results. As I am thinking, changing the width needs to also be checked because it may change the header. The resize in calling for debounce. You can use the debounce from #4 Window resize thresholds:

https://www.lucidchart.com/techblog/201 ... r-project/

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests