Having trouble getting help?
Contact Support
Contact Support
Enable scroller in Angular List box component
27 Apr 20242 minutes to read
The ListBox supports scrolling and it can be achieved by restricting the height of the list box using height
property.
In the following sample, height
of the list box is restricted to 290px
.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { ListBoxComponent,ListBoxAllModule } from '@syncfusion/ej2-angular-dropdowns'
import { ButtonComponent } from '@syncfusion/ej2-angular-buttons'
import { Component } from '@angular/core';
@Component({
imports: [
FormsModule, ReactiveFormsModule, ListBoxAllModule
],
standalone: true,
selector: 'app-container',
template: `<div class="e-section-control">
<ejs-listbox id="listbox" [dataSource]="data" height="290px"></ejs-listbox></div>`
})
export class AppComponent {
public data: { [key: string]: Object }[] = [
{ text: 'Account Settings', id: 'list-01' },
{ text: 'Address Book', id: 'list-02' },
{ text: 'Delete', id: 'list-03' },
{ text: 'Forward', id: 'list-04' },
{ text: 'Reply', id: 'list-05' },
{ text: 'Reply All', id: 'list-06' },
{ text: 'Save All Attachments', id: 'list-07' },
{ text: 'Save As', id: 'list-08' },
{ text: 'Touch/Mouse Mode', id: 'list-09' },
{ text: 'Undo', id: 'list-10' }
];
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));