UNPKG

jqwidgets-scripts-custom

Version:

jQWidgets is an advanced jQuery, Angular 7, Vue, React, ASP .NET MVC, Custom Elements and HTML5 UI framework.

41 lines (33 loc) 1.14 kB
import { Component, ViewChild, ElementRef } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent { @ViewChild('log') log: ElementRef; source: any = { datatype: 'json', datafields: [ { name: 'CompanyName' }, { name: 'ContactName' } ], id: 'id', url: '../assets/customers.txt' }; dataAdapter: any = new jqx.dataAdapter(this.source); listOnSelect(event: any): void { if (event.args) { let item = event.args.item; if (item) { let valueElement = document.createElement('div'); valueElement.innerHTML = `Value: ${item.value}`; let labelElement = document.createElement('div'); labelElement.innerHTML = `Label: ${item.label}`; let selectionLog = this.log.nativeElement; selectionLog.innerHTML = ''; selectionLog.appendChild(labelElement); selectionLog.appendChild(valueElement); } } }; }