vkurko / calendar

Full-sized drag & drop JavaScript event calendar with resource & timeline views
https://vkurko.github.io/calendar/
MIT License
964 stars 82 forks source link

Events for all resources #269

Closed ceciud closed 1 month ago

ceciud commented 1 month ago

Hi, i'm tring to use this repo, it is very good! I have differents resources and i use 'eventSources' `eventSources: [ { events: function (fetchInfo, successCallback, failureCallback) { let params = getFiltersParams();

                params.start = fetchInfo.startStr;
                params.end = fetchInfo.endStr;

                let queryString = new URLSearchParams(params).toString();

                let urlWithParams = `${apiEndpointUrl}?${queryString}`;

                        fetch(urlWithParams,
                            {
                                method: "GET"
                            }).then(res => {

                                return res.json();
                            }).then(res => {
                                successCallback(res);
                            });
                    }

                }
            ],`

If i wan't to share a event with all resources, how i can do? Mi json answer from urlWithParams is, for example: { "type": 2, "start": "2024-05-19T02:00:00", "end": "2024-05-19T11:30:00", "resourceIds": [ "1,2,3,4,5,6,7,8,9" ], "display": "background", "backgroundColor": "#f00" },,

ceciud commented 1 month ago

Sorry, i have to set the json: { "type": 2, "start": "2024-05-19T02:00:00", "end": "2024-05-19T11:30:00", "resourceIds": [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ], "display": "background", "backgroundColor": "#f00" },