import { Component, OnInit, ViewChild } from '@angular/core'; import { CommonService } from '../../../services/common.service'; import { Subject } from 'rxjs'; //import { GeoRegionService } from '../../../services/admin/system/geo-region/geo-region.service'; import { DataTableDirective } from 'angular-datatables'; import { ActivatedRoute, Router } from "@angular/router"; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; @Component({ selector: 'app-specification-guide', templateUrl: './specification-guide.component.html', styleUrls: ['./specification-guide.component.css'] }) export class SpecificationGuideComponent implements OnInit { dtOptions: any = {}; GeoRegionAPIResponse: any; ResultData: any[]; formData: FormData = new FormData(); dtTrigger: Subject = new Subject(); UserId: number = 1; @ViewChild(DataTableDirective) dtElement: DataTableDirective; constructor(private common: CommonService) { } ngOnInit(): void { //this.dtOptions = this.common.dataTableOptionsForSN(true, false, false, true, true, false, true); //this.fillGrid(); this.common.dataTableOptions('#SpecificationGuide', true); } //fillGrid() { // this.service.get(data => { // this.GeoRegionAPIResponse = data; // this.ResultData = this.GeoRegionAPIResponse.objResponse.responseContent; // this.dtTrigger.next(); // }, (error) => { // console.error('Error: ' + error); // return error(error); // }); //} rerender(): void { this.dtElement.dtInstance.then((dtInstance: DataTables.Api) => { // Destroy the table first dtInstance.destroy(); //this.fillGrid(); }); } ngOnDestroy(): void { // Do not forget to unsubscribe the event this.dtTrigger.unsubscribe(); } }