constructor(db: AngularFirestore) {
this.resItems = db.collection('ResourceData').valueChanges().subscribe(resData => {
this.categoryDataSource = resData;
})
this.data = db.collection('Data');
this.items = db.collection('Data').valueChanges().subscribe(data => {
this.items = data;
this.test = data;
let schObj = (document.querySelector('.e-schedule') as any).ej2_instances[0];
let length = this.test.length;
for (let i = 0; i < length; i++) {
let endTime = this.test[i].EndTime.seconds.toString() + "000";
let srtTime = this.test[i].StartTime.seconds.toString() + "000";
this.test[i].StartTime = new Date(parseInt(srtTime));
this.test[i].EndTime = new Date(parseInt(endTime));
}
schObj.eventSettings.dataSource = this.test;
})
} |
Hi, I have a similar question, in my project, data is being loaded from firebase. Unlike shown in this sample, I want to limit the data being retrieved from backend, only the data which needs to be shown should be retireved, based on startdate and end date. that means, i need to update the datasource everytime eventNavigate or datechange occur, while i tried to do that inside actioncomplete, first data was not getting displayed. Then i used, this.scheduleObj.refresh(). Now it works, but there is a small filcker caused by the refresh. Is there a better approch for this scenario?
onActionComplete(args): void {
if ( args.requestType === "viewNavigate" || args.requestType === "dateNavigate") {
var currentViewDates = this.scheduleObj.getCurrentViewDates();
var startDate = new Date(currentViewDates[0]);
var endDate = currentViewDates[currentViewDates.length - 1];
this.eventSettings$ = this._calendar.getEvents(startDate,endDate).pipe(
map((data):EventSettingsModel=>{return {dataSource:data}}),
tap(x=>{this.scheduleObj.refresh();})
)
}
}