Our pure JavaScript Scheduler component


Post by foursite »

Hi,

Thank in advance and i am having hard time autsync work for new assignments

on your demo at https://bryntum.com/products/schedulerpro/examples/nested-events-drag-from-grid/ if i set autosync to true and assign an item from right it sends a sync request and get stuck in sync loop , update and delete work fine , i am using gantt too and autosync on new task works fine and i am using same response structure in above example but it just get stuck in loop,

also could not add json response here as it keep giving me this error even when i wrap it in [ CODE ] [ /CODE ]
'Please wrap your code in [ CODE ] [ /CODE] tags'

Attachments
Screenshot 2022-11-24 at 17.01.06.png
Screenshot 2022-11-24 at 17.01.06.png (104.62 KiB) Viewed 526 times

Post by alex.l »

Hi foursite,

What operation have you done to get this response? As I understood - you dropped a nested event into one of events from the list?
What do you see in requests when you have a loop? In first request? In first response? In other responses? I see only assignment added in the response, but what about event added?
Please also make sure you used latest released version, we had some problems with assignments adding in on one previous versions.

All the best,
Alex


Post by foursite »

These are request and response data and version is Bryntum Scheduler Pro 5.2.3

Attachments
Screenshot 2022-11-25 at 09.58.02.png
Screenshot 2022-11-25 at 09.58.02.png (115.94 KiB) Viewed 495 times
Screenshot 2022-11-25 at 09.58.17.png
Screenshot 2022-11-25 at 09.58.17.png (112.68 KiB) Viewed 495 times

Post by marcio »

Hey foursite,

Any chance to check what your config looks like?? Maybe a sample project with that would be great to help you and understand the problem to assist you better.

Best regards,
Márcio


Post by foursite »

can you plz try to replace

new ProjectModel

parameter with code below? on https://bryntum.com/products/schedulerpro/examples/nested-events-drag-from-grid/ and try to drag task from right to grid? and asson as you drag it would in a sync loop

so the url

https://backend.staging.app.worksavi.com/api/wae/test_bryntum'

would process only resources.add request and assign $PhantomId to id column , i know you may say the response structure i am returning wrong but again that was the question in first place

{
  autoLoad: true,
  autoSync: true,
  transport: {
    load: {
      url: './data/data.json',
    },

sync: {
  requestConfig: {
    url: 'https://backend.staging.app.worksavi.com/api/wae/test_bryntum',
    method: 'POST',
    disableCaching: false,
    fetchOptions: {
      credentials: 'omit',
    },
    headers: {
      'Content-Type': 'application/json; charset=utf-8',
      Accept: 'application/json',
      'X-Tenant': '093f1b6a-2e69-4e63-a125-e71575330379',
    },
  },
},
  },
  eventStore: {
    // Dont remove unassigned events, we want to display them in the unplanned jobs grid
    removeUnassignedEvent: false,
  },
}

Post by alex.l »

Thank you for the test case. I ran your code and see the next notification in the console:

Project sync response error(s):
- "assignments" store "rows" section should mention added record(s) #_generatedClassDefEx_59decd2b-613c-4dd5-afe3-b01c77840f42 sent in the request. It should contain the added records identifiers (both phantom and "real" ones assigned by the backend).
Please adjust your response to look like this:
{
    "assignments": {
        "rows": [
            {
                "$PhantomId": "_generatedClassDefEx_59decd2b-613c-4dd5-afe3-b01c77840f42",
                "id": ...
            }
        ]
    }
}
Note: To disable this validation please set the "validateResponse" config to false

Your response doesn't have new id and it's also encoded. I've attached 2 examples of response. First one yours and second one from our php example. Please see only encoding and not formatting. There are different examples.

Please try to fix it and test again.

Attachments
Screenshot 2022-12-01 at 18.57.10.png
Screenshot 2022-12-01 at 18.57.10.png (131.62 KiB) Viewed 401 times
Screenshot 2022-12-01 at 18.56.43.png
Screenshot 2022-12-01 at 18.56.43.png (129.57 KiB) Viewed 401 times

All the best,
Alex


Post by foursite »

well thats weird that for you response is not json because the second screenshot i attached of response clearly is json encoded and i can even in response header see that Content-Type: application/json (i am on chrome) , wil apply your suggestion about wrapping the response array in "rows" index


Post by foursite »

is there any doc on the respone format for sync opreations ?


Post by alex.l »

Sure, sorry I didn't share it before. Here is full guide https://bryntum.com/products/gantt/docs/guide/Gantt/data/crud_manager

All the best,
Alex


Post Reply