This is what we do! We add a timer that after X amount of minutes trigger the Medinet.bryntum.update();
We get the last part (commented out) as the response but we then get an error from your script. Can you figure something out from the supplied code?
'use strict';
/* globals bryntum */
var Medinet = Medinet || {};
Medinet.bryntum = function() {
var scheduler;
return {
init: function() {
var element = document.getElementById('demo');
scheduler = new bryntum.scheduler.Scheduler({
id: element + '_initialized',
appendTo: element,
columns: [
{
"field": "hospital", "text": "Sjukhus",
}, {
"field": "clinic", "text": "Klinik",
}, {
"field": "activity", "text": "Aktivitet",
}, {
"field": "category", "text": "Kategori",
},
],
startDate: '2020-08-11',
endDate: '2020-08-11',
features: {
group: false,
sort: {...},
timeRanges: {...},
filter: {
reapplyFilterOnAdd: true,
reapplyFilterOnUpdate: true,
},
filterBar: true,
eventDrag: false,
eventDragCreate: false,
eventResize: false,
eventEdit: false,
eventEditor: false,
},
crudManager: {
autoLoad: true,
transport: {...},
listeners: {
loadfail: function() {...},
requestdone: function(data) {...},
},
},
});
},
update: function() {
var xhr = new XMLHttpRequest();
xhr.open('GET', [REQ_URL], true);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.onload = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var response = JSON.parse(xhr.responseText);
scheduler.store.data = response;
}
}
};
xhr.send(null);
},
};
}();
// Response is:
// {
// "events":{
// "rows":[
// {
// "endDate":"2020-08-11T16:30",
// "event_details_url":"/oncall/popover/event_daily_details?customer_id=274&event_id=c-274_e-12666",
// "event_num_oncall_time_comments":0,
// "have_event_information":false,
// "id":"c-274_e-12666",
// "name":"Mattias Frans",
// "resourceId":"c-274_ar-33",
// "startDate":"2020-08-11T08:00",
// "text":"Mattias Frans"
// },
// {
// "endDate":"2020-08-11T07:30",
// "event_details_url":"/oncall/popover/event_daily_details?customer_id=274&event_id=c-274_e-12670",
// "event_num_oncall_time_comments":0,
// "have_event_information":false,
// "id":"c-274_e-12670",
// "name":"Johanna Andersson",
// "resourceId":"c-274_ar-34",
// "startDate":"2020-08-10T16:30",
// "text":"Johanna Andersson"
// },
// {
// "endDate":"2020-08-12T07:30",
// "event_details_url":"/oncall/popover/event_daily_details?customer_id=274&event_id=c-274_e-12663",
// "event_num_oncall_time_comments":0,
// "have_event_information":false,
// "id":"c-274_e-12663",
// "name":"Kerstin Blomma",
// "resourceId":"c-274_ar-34",
// "startDate":"2020-08-11T16:30",
// "text":"Kerstin Blomma"
// },
// {
// "endDate":"2020-08-12T07:30",
// "event_details_url":"/oncall/popover/event_daily_details?customer_id=274&event_id=c-274_e-12676",
// "event_num_oncall_time_comments":0,
// "have_event_information":false,
// "id":"c-274_e-12676",
// "name":"Karl Kula",
// "resourceId":"c-274_ar-34",
// "startDate":"2020-08-11T16:30",
// "text":"Karl Kula"
// },
// {
// "endDate":"2020-08-11T16:30",
// "event_details_url":"/oncall/popover/event_daily_details?customer_id=274&event_id=c-274_e-12671",
// "event_num_oncall_time_comments":0,
// "have_event_information":false,
// "id":"c-274_e-12671",
// "name":"Johanna Andersson",
// "resourceId":"c-274_a-77",
// "startDate":"2020-08-11T08:00",
// "text":"Johanna Andersson"
// },
// {
// "endDate":"2020-08-11T16:30",
// "event_details_url":"/oncall/popover/event_daily_details?customer_id=274&event_id=c-274_e-12677",
// "event_num_oncall_time_comments":0,
// "have_event_information":false,
// "id":"c-274_e-12677",
// "name":"Karl Kula",
// "resourceId":"c-274_a-77",
// "startDate":"2020-08-11T08:00",
// "text":"Karl Kula"
// },
// {
// "endDate":"2020-08-12T08:00",
// "event_details_url":"/oncall/popover/event_daily_details?customer_id=274&event_id=c-274_e-12674",
// "event_num_oncall_time_comments":0,
// "have_event_information":false,
// "id":"c-274_e-12674",
// "name":"Johanna Andersson",
// "resourceId":"c-274_a-5",
// "startDate":"2020-08-11T16:00",
// "text":"Johanna Andersson"
// }
// ]
// },
// "header":"Dagens jourer",
// "header_datestring":"Tisdag 11 augusti 2020",
// "minVersionReq":4,
// "resources":{
// "rows":[
// {
// "activity":[
// {
// "className":"open-tooltip",
// "link":"/oncall/popover/get_activity_daily?customer_id=274&selected_date=2020-08-11&activity_id=c-274_ar-33",
// "text":"Prim\u00e4rjour"
// }
// ],
// "category":[
//
// ],
// "clinic":[
// {
// "link":"/oncall?layout=full&view=%2Foncall%2Fweekly&view_type=weekly&selected_date=2020-08-11&oncall_customer_id=274&action=selected",
// "text":"Ortopedkliniken"
// }
// ],
// "hospital":"",
// "id":"c-274_ar-33"
// },
// {
// "activity":[
// {
// "className":"open-tooltip",
// "link":"/oncall/popover/get_activity_daily?customer_id=274&selected_date=2020-08-11&activity_id=c-274_ar-34",
// "text":"Prim\u00e4rjour natt"
// }
// ],
// "category":[
// {
// "link":"/oncall?layout=full&view=%2Foncall%2Fweekly&view_type=weekly&selected_date=2020-08-11&oncall_customer_id=274&category_id=35&action=selected",
// "text":"Akuten"
// }
// ],
// "clinic":[
// {
// "link":"/oncall?layout=full&view=%2Foncall%2Fweekly&view_type=weekly&selected_date=2020-08-11&oncall_customer_id=274&action=selected",
// "text":"Ortopedkliniken"
// }
// ],
// "hospital":"",
// "id":"c-274_ar-34"
// },
// {
// "activity":[
// {
// "className":"open-tooltip",
// "link":"/oncall/popover/get_activity_daily?customer_id=274&selected_date=2020-08-11&activity_id=c-274_a-77",
// "text":"Dagbakjour"
// }
// ],
// "category":[
//
// ],
// "clinic":[
// {
// "link":"/oncall?layout=full&view=%2Foncall%2Fweekly&view_type=weekly&selected_date=2020-08-11&oncall_customer_id=274&action=selected",
// "text":"Ortopedkliniken"
// }
// ],
// "hospital":"",
// "id":"c-274_a-77"
// },
// {
// "activity":[
// {
// "className":"open-tooltip",
// "link":"/oncall/popover/get_activity_daily?customer_id=274&selected_date=2020-08-11&activity_id=c-274_a-5",
// "text":"Jourvecka 1"
// }
// ],
// "category":[
//
// ],
// "clinic":[
// {
// "link":"/oncall?layout=full&view=%2Foncall%2Fweekly&view_type=weekly&selected_date=2020-08-11&oncall_customer_id=274&action=selected",
// "text":"Ortopedkliniken"
// }
// ],
// "hospital":"",
// "id":"c-274_a-5"
// }
// ]
// },
// "selected_date":"2020-08-11",
// "success":true
// }