Premium support for our pure JavaScript UI components


Post by rahulranjan »

Hi
I am facing some issue which occurs some times.
1. Select the task
2. click on edit
3. Instead of showing edit pop up it gives error.

Can you let me know about the error. Why it is happening.
Attachments
SendTaskEdiBug.PNG
SendTaskEdiBug.PNG (19.75 KiB) Viewed 1601 times

Post by sergey.maltsev »

Hi, rahulranjan!
Could you please provide your sample code or if you see it in our demo then tell which one and send the action sequence to reproduce it?

Post by rahulranjan »

Hi
Its not happening every time as mention before. It occurs some times in which case it fails. If you have any clue regarding this then please let me know.

What i think it may be because of the below code. As the error is telling. So for the first time it returns false. And after time out it returns true.
can not create property 'extraItems' on boolean false. 

This is the code can you let me know where it is going wrong.
this.gantt.on("beforeTaskEdit", ({ taskEdit, taskRecord }) => {
      const activityType = taskRecord.activityType;
      if (!taskEdit.additionalDataLoaded) {
        this.gantt.mask("Loading data ...");
        // emulate async await request
        setTimeout(async () => {
          try {
            if (!this.UOM.length) {
              this.UOM = await this.service.loadUom();
            }
            const record = await this.service.loadActivitiyInfo(
              taskRecord.ID,
              this.defaultScheduleID,
              this.projectID,
              activityType
            );
            this.gantt.unmask();
            taskEdit.additionalDataLoaded = true;
            taskEdit._editing = false;
            taskEdit.editTask(taskData);
            return true;
          } catch (err) {
            this.gantt.unmask();
            Toast.show(err.error.message);
            return false;
          }
        }, 2000);
        return false;
      }

Post by sergey.maltsev »

Hi, rahulranjan!

This your code above is only the part you use to call task editor.
Probably there's a problem in taskEditor config which leads to the error you have.
Please attach the whole source code (zip) which can be compiled and tested.

Post by rahulranjan »

Hi
taskEdit: {
      tabsConfig: {
        resourcestab: false,
        advancedtab: false
      },
      editorConfig: {
        height: "41em",
        showDeleteButton: true,
        extraItems: {
          generaltab: [
            {
              type: "textfield",
              ref: "ActivityTypeField",
              name: "activityType",
              label: "Activity Type",
              disabled: true,
              flex: "1 0 50%",
              cls: "b-inline"
            },

This is the config i am doing.

Post by sergey.maltsev »

Hi, rahulranjan!

Please attach the whole project here so we can just build and click to test but not guess what's wrong.

Post by rahulranjan »

Hi
I am attaching the angular Project
Steps to Run
1. Extract the project
2. Do npm Install
3. ng s - to start the project

Steps To reproduce
1. Click on Home (hyperlink)
2. Then click on Gantt (hyperlink)
3. Select task click on Edit tasks button.
4. Close Editor Pop Up
5. Repeat Step 1,2 ,3 - Check in Console you will get error. And Editor pop up will not appear.
Attachments
advanced.rar
(1.81 MiB) Downloaded 113 times

Post by sergey.maltsev »

Hi, rahulranjan!

I've tried your sample code. But found no errors in console flowing your steps.
I've attached a bit modified code for correct TaskModel implementation and few fixes to TaskEdit layout.
If you can reproduce error with the attached project may be you can confirm the steps again and then I can recheck.
Attachments
advanced-forum.rar
(1.22 MiB) Downloaded 124 times

Post by rahulranjan »

Hi
I have run the project. It still gives the same error
Steps to Reproduce
1. Run the project
2. Select Home
3. Then click on gantt
4. select the task
5. click on Edit button
6. close the edit pop up
7. click on Home
8. Click on gantt
9. select the task
10. Click on edit button
You will be able to see the error. Edit pop won't open.

Post by saki »

The routing of the Angular application causes that the html markup of gantt is destroyed always when the "Home" is selected and then the gantt is re-created when "Gantt" route is selected. This leads to unpredictable behavior of gantt instances piling up on each navigation. It is because ngOnInit run always when navigation to Gantt so the new instance is created.

The problem has a two possible solutions:
  1. to destroy gantt on each navigating away from Gantt route
  2. to implement a non-destroying routing - recommended.
We do not have a demo for the first solution but there is the demo for the preferred one. See please Angular Routing + NgRx demo

Post Reply