UNPKG

jqwidgets-framework

Version:

jQWidgets is an advanced Angular, Vue, Blazor, React, Web Components, jquery, ASP .NET MVC, Custom Elements and HTML5 UI framework.

26 lines (21 loc) 1.07 kB
import { Component, ViewChild, AfterViewInit } from '@angular/core'; import { jqxTreeComponent } from 'jqwidgets-ng/jqxtree'; import { jqxDropDownButtonComponent } from 'jqwidgets-ng/jqxdropdownbutton'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent implements AfterViewInit { @ViewChild('myTree', { static: false }) myTree: jqxTreeComponent; @ViewChild('myDropDownButton', { static: false }) myDropDownButton: jqxDropDownButtonComponent; ngAfterViewInit(): void { this.myDropDownButton.setContent('<div style="position: relative; margin-left: 3px; margin-top: 4px;">Home</div>'); } myTreeOnSelect(event: any): void { if (this.myTree && this.myDropDownButton) { const item = this.myTree.getItem(event.args.element); const dropDownContent = '<div style="position: relative; margin-left: 3px; margin-top: 4px;">' + item.label + '</div>'; this.myDropDownButton.setContent(dropDownContent); } } }