Premium support for our pure JavaScript UI components


Post by rahulranjan »

HI
Steps to Reproduce
1. Run the project(npm Install , run ng s ) - Angular Project
2. Select the WBS:W3 Task .
3. Click on Edit Task
4. Give Some Value in WBS weightage Field
5. Click on Save System will stop responding

. From my point what i think on below method but don't know the exact issue
this.gantt.on("beforeTaskEdit", async ({ taskEdit, taskRecord }) => {
As i am not loading the task data at once on loading it on demand . So on above method i am making async await call to server and getting the data and putting it on task.
Attachments
advanced02.rar
(1.83 MiB) Downloaded 89 times

Post by saki »

I don't think that the listener itself can be an async function. Try to install listener as a normal function and handle the async requirements from within the listener.

Post by rahulranjan »

Hi Saki
I removed the listener as async but then also it hang up . As i am load data to show in task editor and i am loading it on demand .

Post by Maxim Gorkovsky »

Hello.
I cannot reproduce this problem on the provided test case. Please amend.
Also I'd like to point out that async listeners are not supported. More precisely, promise returned from async functions is ignored.

Post by rahulranjan »

Hi Maxim
Steps to Reproduce
Run the project
1. Select WBS: W1 -click on Edit and save
2. Select WBS: W2 - click on Edit and Save
3. Select WBS:W3 task which is under - WBS W2
4. Click on Edit and system hangs on

Problem :I wanted to load the task data on demand not all the data of a task at once . I.e to show the values in task Editor .
Attachments
advanced02.rar
(1.83 MiB) Downloaded 81 times

Post by Maxim Gorkovsky »

Reproduced.
Problem is that you are manipulating inner state of the task edit feature, setting taskEdit._editing flag to false, editor falls into infinite loop of rescheduling target task. You need to return false from beforeTaskEdit listener if your event is not yet loaded. That would prevent unnesessary editing window.

Post by Maxim Gorkovsky »

Also I need to warn you, that using private API (like _editing property) is not very robust. Private APIs might break unexpectedly when you upgrage gantt to next version and we only warn about public API changes. I recommend to stick to public API as much as possible.

Post by rahulranjan »

Thanks
I tried but its not working out. Now it does not show the editor only .
Problem : I have to data the task data before showing it in the Edtitor . So i am doing it like this.
What will the best way to do this pleas let me know .
Attach is project where i have implemented .

Post by Maxim Gorkovsky »

You could try smth like:
gantt.on({
  beforeTaskEdit({ taskRecord }) {
    if (!taskRecord.dataLoaded) {
      gantt.mask();
      loadTask(taskRecord); // this would open task editor asynchronously, when it is loaded
      return false; // return false to prevent opening dialog first time
    }
  }
});

async loadTask(record) {
  // load record asynchronously, need method first to return false to prevent opening editor
  await ....
  gantt.taskEdit.editTask(record);
}

Post by rahulranjan »

Hi Thanks
I tried to implement the way now edit is not opening only
Attachments
advanced02.rar
(1.83 MiB) Downloaded 89 times

Post Reply