import { Component, OnInit, AfterViewInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { jqxSortableComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxsortable';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
encapsulation: ViewEncapsulation.None
})
export class AppComponent implements OnInit, AfterViewInit {
@ViewChild('mySortable1') mySortable1: jqxSortableComponent;
@ViewChild('mySortable2') mySortable2: jqxSortableComponent;
ngOnInit(): void {
const firstNames = ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert', 'Laura', 'Anne'];
const lastNames = ['Davolio', 'Fuller', 'Leverling', 'Peacock', 'Buchanan', 'Suyama', 'King', 'Callahan', 'Dodsworth'];
const titles = ['Sales Representative', 'Vice President, Sales', 'Sales Representative', 'Sales Representative', 'Sales Manager', 'Sales Representative', 'Sales Representative', 'Inside Sales Coordinator', 'Sales Representative'];
const firstNamesLength = firstNames.length;
const firstNamesHalf = Math.floor(firstNamesLength / 2);
let sortableList1 = '';
let sortableList2 = '';
for (let i = 0; i < firstNames.length; i++) {
let imgurl = 'https://www.jqwidgets.com/angular/images/' + firstNames[i].toLowerCase() + '.png';
let img = '';
let element = '
| ' + img + ' | ' + firstNames[i] + ' ' + lastNames[i] + ' |
| ' + titles[i] + ' |