jqwidgets-scripts-custom
Version:
jQWidgets is an advanced jQuery, Angular 7, Vue, React, ASP .NET MVC, Custom Elements and HTML5 UI framework.
35 lines (28 loc) • 1.03 kB
text/typescript
import { Component, ViewChild, AfterViewInit, ElementRef } from '@angular/core';
import { jqxListBoxComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxlistbox';
export class AppComponent implements AfterViewInit {
myListBox: jqxListBoxComponent;
select: ElementRef;
ngAfterViewInit() {
this.myListBox.loadFromSelect('select');
}
updating = false;
change(event: any): void {
this.updating = true;
let index = this.select.nativeElement.selectedIndex;
this.myListBox.selectIndex(index);
this.myListBox.ensureVisible(index);
this.updating = false;
};
selectItem(event: any): void {
if (event.args && !this.updating) {
// select the item in the 'select' tag.
let index = event.args.item.index;
this.select.nativeElement.selectedIndex = index;
}
};
}