Bold BI®Unlock stunning dashboards with Bold BI®: 35+ widgets, 150+ data sources, AI agent & more. Try it for free!
Hi,
Im trying to use ejGantt with Redux(Ngrx) in my project simulator web app, so all actions must to be done in the state, so i get Data from store like bellow :
and i have two way to manage my Projects (edit Tasks), the first way is by edit dialog and every thing work properly and the second way is directly in Gantt Chart by projection or transition task and i update the State with TaskBarEdited $event in html :
and in ts it like :
and this where the problem appear after 2 or 3 successfully edit
and some time it appear in a repetitive way according to the mouse movement until the app crash
any help will be appreciated
Thanks.
appComponent.ts
public actionComplete(args: any) {
if (args.requestType == "save") {
this.TaskService.updateRecord(this.tasks).subscribe(() => {
args.endEdit();
}, (e) => {
this.ganttChart.endEdit();
}
);
}
if (args.requestType == 'add') {
this.TaskService.addRecord(this.tasks).subscribe(() => {
args.endEdit();
});
this.TaskService.addRecord(this.tasks).subscribe(() => { }, error => console.log(error), () => {
args.endEdit();
});
}
if (args.requestType == 'delete') {
this.TaskService.deleteRecord(this.tasks).subscribe(() => {
args.endEdit();
});
}
}
|
addRecord(state: any): Observable<any> {// you can apply empty string instead of state.data to get failure(error)
return this.http.post<TaskModel>(this.apiUrl, state.data, httpOptions);
}
/** DELETE: delete the record from the server */
deleteRecord(state: any): Observable<any> {
const id = state.data[0].id;
const url = `${this.apiUrl}/${id}`;
return this.http.delete<TaskModel>(url, httpOptions);
}
/** PUT: update the record on the server */
updateRecord(state: any): Observable<any> {
return this.http.put(this.apiUrl, state.data, httpOptions);
} |