Our state of the art Gantt chart


Post by stevend »

I've created a custom task field called status. When I make a change, i.e. set percentDone to 100%, I update a number of related tasks server-side. The sync operation returns those related tasks in the tasks updated list (for each task the id and the new status field).
As I understand from the docs, the updated tasks should be refreshed in the Gantt diagram automically. But this doesn't happen. If I reload the page, and thus force a reload of all the data again, I do see the updated data. Am I missing something? I'm using auto sync

transport: {
    load: {
        url: 'https://localhost:8080/api/planning',
    },
    sync: {
        url: 'https://localhost:8080/api/planning',
            method: 'PUT'
   }

I've defined the status field on my custom task class as

{name: 'status', dataSource: 'Status', type: 'string'},

And my server-side sync operation returns:

{
  "success": true,
  "requestId": 16182353987171,
  "revision": 1,
  "tasks": {
    "updated": [
      {
        "id": 1151,
        "status", "updated"
      },
      {
        "id": 1152,
        "status", "updated"
      },
      {
        "id": 1154,
        "status", "updated"
      },
      {
        "id": 1153,
        "status", "updated"
      },
      {
        "id": 1150,
        "status", "updated"
      },
      {
        "id": 15,
        "status", "updated"
      }
    ]
  },
  "assignments": {
    "added": []
  }
}

AFAIK, I don't need to trigger a refresh manually, do I?


Post by pmiklashevich »

You set dataSource: 'Status' with capital key, but pass the data in lower case.
https://www.bryntum.com/docs/gantt/#Core/data/field/DataField#config-dataSource
Try to remove dataSource config. It defaults to field's name

Pavlo Miklashevych
Sr. Frontend Developer


Post by stevend »

I removed the dataSource config, but I still have the same issue: after a sync the updates aren't shown.


Post by mats »

Any chance you could zip up a small runnable test case we can look at?


Post by stevend »

That's not going to be easy I'm afraid. Are there any listeners to the sync or refresh functions that I could use to debug this?



Post by stevend »

I found the issue, turns out my response was not correct. I sent the updated tasks as

{
    ...
    "tasks": {
        "updated": [
        {
            "id": 1151,
            "status", "updated"
        },
   ...
}

but updated should be rows. When I send it as this, it works:

{
    ...
    "tasks": {
    "rows": [
      {
        "id": 1151,
        "status", "updated"
      },
    ...
}

Post Reply