The DropDownButton component for Angular will be able to display any type of content inside a DropDown.
npm install -g @angular/cli ng new jqwidgets-project cd jqwidgets-project
ng add jqwidgets-ngAlternatively, you can use the standard installation (Manual Setup)
jQWidgets UI for Angular is distributed as jqwidgets-ng NPM package
npm install jqwidgets-ng
@import 'jqwidgets-ng/jqwidgets/styles/jqx.base.css';
"styles": [ "node_modules/jqwidgets-ng/jqwidgets/styles/jqx.base.css" ]
<jqxDropDownButton [theme]="'fluent'" #myDropDownButton style="float: left"
[width]="150" [height]="25">
<jqxTree [theme]="'fluent'" #myTree
(onSelect)="treeOnSelect($event)" [width]="200">
<ul>
<li item-selected='true'>Home</li>
<li item-expanded='true'>
Solutions
<ul>
<li>Education</li>
<li>Financial services</li>
<li>Government</li>
<li>Manufacturing</li>
<li>
Solutions
<ul>
<li>eLearning</li>
<li>Mobile</li>
<li>RIA</li>
<li>Training</li>
</ul>
</li>
</ul>
</li>
<li>
Products
<ul>
<li>PC products</li>
<li>Mobile products</li>
<li>All products</li>
</ul>
</li>
</ul>
</jqxTree>
</jqxDropDownButton>
<div style="float: left; margin-top: 5px; margin-left: 30px">
<jqxCheckBox [theme]="'fluent'" (onChange)="checkBoxOnChange($event)">
Open On Mouse Over
</jqxCheckBox>
</div>
import { Component, ViewChild, AfterViewInit, ViewEncapsulation } from '@angular/core';
import { jqxTreeModule, jqxTreeComponent } from 'jqwidgets-ng/jqxtree';
import { jqxDropDownButtonModule, jqxDropDownButtonComponent } from 'jqwidgets-ng/jqxdropdownbutton';
@Component({
selector: 'app-root',
imports: [jqxDropDownButtonModule, jqxTreeModule],
standalone: true,
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
encapsulation: ViewEncapsulation.None
})
export class AppComponent implements AfterViewInit {
@ViewChild('myDropDownButton') myDropDownButton: jqxDropDownButtonComponent;
@ViewChild('myTree') myTree: jqxTreeComponent;
ngAfterViewInit(): void {
this.myDropDownButton.setContent('<div style="position: relative; margin-left: 3px; margin-top: 4px;">Home</div>');
}
treeOnSelect(event: any): void {
let item = this.myTree.getItem(event.args.element);
let dropDownContent = `<div style="position: relative; margin-left: 3px; margin-top: 4px;">${item.label}</div>`;
this.myDropDownButton.setContent(dropDownContent);
}
checkBoxOnChange(event: any): void {
this.myDropDownButton.autoOpen(event.args.checked);
}
}