Our state of the art Gantt chart


Post by jhunnie20 »

Hi,

I'd like to know if there is a way to add more response data when saving ?

Here is an example: (this is based on crud manager docs response examples)
{
        "requestId" : 124,
        "type"      : "sync",
        "revision"  : 5,

        "books"     : {
            "added" : [
                { "$PhantomId" : "book-123", "title" : "Pet Sematary", "published" : 1983  , "a_custom_field": "custom_field_value"}
            ],
            "updated" : [
                { "id" : 65, "title" : "War and Peace" , "a_custom_field": "custom_field_value"}
            ],
            "removed" : [
                { "id" : 9001 }
            ]
        },

        "writers"      : {
            "added" : [
                { "$PhantomId" : "writer-321", "name" : "Stephen", "surname" : "King" , "a_custom_field": "custom_field_value" }
            ]
        },

        "authors"      : {
            "added" : [
                { "$PhantomId" : "author-555", "book_id" : "book-123", "writer_id" : "writer-321"  , "a_custom_field": "custom_field_value"}
            ],
            "removed" : [
                { "id" : 3 }
            ]
        }
    }
If you look at the response I added

"a_custom_field": "custom_field_value" on response. Is this possible ? or are we going to edit the build js files you provided which is minified that makes it hard for us to read.

Looking forward :D

Thanks!

J

Post by arcady »

All custom fields you add to the models are persisted automatically. No need to do any extra setup. :)

You can find an example of defining custom fields in the TaskModel docs ("Subclassing the TaskModel class" chapter): https://www.bryntum.com/docs/gantt/#Gantt/model/TaskModel

Post by jhunnie20 »

Thanks for the info!

will check the link you provided

Post by jhunnie20 »

Oops, how about whenever I add/remove assignee on task, Can I configure it to have the task ID? currently Im getting resource ID and event ID only whenever i made changes.. Another example is whenever I add new subtask on a parent task, Is it possible to put the parent task ID with it ?

Post by pmiklashevich »

how about whenever I add/remove assignee on task, Can I configure it to have the task ID?
currently Im getting resource ID and event ID only whenever i made changes.
https://www.bryntum.com/docs/gantt/#Gantt/model/AssignmentModel
Assignment model already has resourceId and eventId fields. Do you want to be taskId there instead of eventId?
whenever I add new subtask on a parent task, Is it possible to put the parent task ID with it ?
parentId is sent as part of task data whenever a subtask is created.

When you ask for help please provide more details always, so it's easy to get what you're trying to achieve, what's happening and what the expected result is. viewtopic.php?f=35&t=772

Best,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply