Display items in groups in Angular ListBox.
A live Angular example of jqxListBox, the jQWidgets ListBox component, with its complete source code below. It is one of 18 jqxListBox demos for Angular.
height property – Sets or gets the listbox's height.source property – Sets or gets the item's source.width property – Sets or gets the listbox's width.To run it in your own app, install the package with npm install jqwidgets-ng, add these files to a standalone Angular CLI app, and add jqx.base.css and a theme to the styles in angular.json. Getting started with jqxListBox shows the setup step by step.
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { jqxListBoxModule } from 'jqwidgets-ng/jqxlistbox';
@Component({
imports: [CommonModule, jqxListBoxModule],
selector: 'app-root',
templateUrl: './app.html'
})
export class App {
source: any[] = [
// Business & Investing
{ html: "<div><div>Title: Do the Work</div><div>Author: Steven Pressfield</div></div>", title: "Do the Work", group: "Business & Investing" },
{ html: "<div><div>Title: Think and Grow Rich</div><div>Author: Napoleon Hill</div></div>", title: "Think and Grow Rich", group: "Business & Investing" },
{ html: "<div><div>Title: The Toyota Way to Continuous...</div><div>Author: Jeffrey K. Liker</div></div>", title: "The Toyota Way to Continuous...", group: "Business & Investing" },
{ html: "<div><div>Title: Redesigning Leadership </div><div>Author: John Maeda</div></div>", title: "Redesigning Leadership ", group: "Business & Investing" },
// Computer & Internet Books
{ html: "<div><div>Title: MacBook Pro Portable Genius</div><div>Author: Brad Miser</div></div>", title: "MacBook Pro Portable Genius", group: "Computer & Internet Books" },
{ html: "<div><div>Title: Social Media Metrics Secrets</div><div>Author: John Lovett</div></div>", title: "Social Media Metrics Secrets", group: "Computer & Internet Books" },
{ html: "<div><div>Title: iPad 2: The Missing Manual</div><div>Author: J D Biersdorfer J.D</div></div>", title: "iPad 2: The Missing Manual", group: "Computer & Internet Books" },
// History
{ html: "<div><div>Lincoln and His Admirals</div><div>Author:Craig L. Symonds</div></div>", title: "Lincoln and His Admirals", group: "History" },
{ html: "<div><div>The Dogs of War: 1861</div><div>Author:Emory M. Thomas</div></div>", title: "The Dogs of War: 1861", group: "History" },
{ html: "<div><div>Cleopatra: A Life</div><div>Author:Stacy Schiff</div></div>", title: "Cleopatra: A Life", group: "History" },
{ html: "<div><div>Mother Teresa: A Biography</div><div>Author:Meg Greene</div></div>", title: "Mother Teresa: A Biography", group: "History" },
{ html: "<div><div>The Federalist Papers</div><div>Author:John Jay</div></div>", title: "The Federalist Papers", group: "History" },
];
}
<jqxListBox #jqxListBox
[source]="source"
[height]="300"
[width]="350">
</jqxListBox>