auto trigger refresh
This commit is contained in:
parent
a24209c8d9
commit
1d5eaffe95
@ -5,6 +5,7 @@ import { FormGroup, FormBuilder } from '@angular/forms';
|
|||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { NotifierService } from 'angular-notifier';
|
import { NotifierService } from 'angular-notifier';
|
||||||
import { DuplicatePdComponent } from '../duplicate-pd/duplicate-pd.component';
|
import { DuplicatePdComponent } from '../duplicate-pd/duplicate-pd.component';
|
||||||
|
// import { Subscription, interval } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-all-pd',
|
selector: 'app-all-pd',
|
||||||
@ -49,6 +50,8 @@ export class AllPdComponent implements OnInit, OnChanges {
|
|||||||
pageEvent: PageEvent;
|
pageEvent: PageEvent;
|
||||||
todaydate:Date = new Date();
|
todaydate:Date = new Date();
|
||||||
common: any;
|
common: any;
|
||||||
|
// subscription: Subscription;
|
||||||
|
|
||||||
constructor(private dialog: MatDialog,private _pd: PdTrigerService,private _fb:FormBuilder,notifier: NotifierService,) {
|
constructor(private dialog: MatDialog,private _pd: PdTrigerService,private _fb:FormBuilder,notifier: NotifierService,) {
|
||||||
this.notifier = notifier;
|
this.notifier = notifier;
|
||||||
this.searchForm = this._fb.group(
|
this.searchForm = this._fb.group(
|
||||||
@ -77,6 +80,31 @@ export class AllPdComponent implements OnInit, OnChanges {
|
|||||||
this.recordStatus=false;
|
this.recordStatus=false;
|
||||||
// this.loadPDDetails();
|
// this.loadPDDetails();
|
||||||
//this.getcommonDropDown();
|
//this.getcommonDropDown();
|
||||||
|
// window.addEventListener('blur', () => {
|
||||||
|
// console.log("Browser tab is hidden")
|
||||||
|
// });
|
||||||
|
window.addEventListener('visibilitychange', () => {
|
||||||
|
console.log("Browser tab is visible")
|
||||||
|
this.loadPDDetails()
|
||||||
|
});
|
||||||
|
|
||||||
|
// document.addEventListener("visibilitychange", function() {
|
||||||
|
// if (document.hidden){
|
||||||
|
// console.log("Browser tab is hidden")
|
||||||
|
// } else {
|
||||||
|
// console.log("Browser tab is visible")
|
||||||
|
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//emit value in sequence every 10 second
|
||||||
|
// const source = interval(10000);
|
||||||
|
// const text = 'Your Text Here';
|
||||||
|
// this.subscription = source.subscribe(val => this.loadPDDetails());
|
||||||
|
|
||||||
|
// document.addEventListener('visibilitychange', function(){
|
||||||
|
// console.log('ZZZZ')
|
||||||
|
// // document.title = document.hidden; // change tab text for demo
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
// get changes for filter from parent componnet filter
|
// get changes for filter from parent componnet filter
|
||||||
@ -84,6 +112,7 @@ export class AllPdComponent implements OnInit, OnChanges {
|
|||||||
let filteredText = changes.bindFilterValue.currentValue ? changes.bindFilterValue.currentValue.trim() : changes.bindFilterValue.currentValue;
|
let filteredText = changes.bindFilterValue.currentValue ? changes.bindFilterValue.currentValue.trim() : changes.bindFilterValue.currentValue;
|
||||||
filteredText = filteredText ? filteredText.toLowerCase() : filteredText;
|
filteredText = filteredText ? filteredText.toLowerCase() : filteredText;
|
||||||
this.dataSourceTab1.filter = filteredText;
|
this.dataSourceTab1.filter = filteredText;
|
||||||
|
// this.subscription.unsubscribe();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user