I am using DHTMLX Scheduler for booking an appointments. To avoid a double booking I have shown a block on a time slot which has already been selected by some other user but yet to be done with appointment process.
I have setInterval to check the status of appointment which is currently in process by some other users.
What I want is if I get some data in setInterval that particular block should be removed. Following is a script that I am using to show block and other appointments on scheduler.
// This is how I'm showing block area on scheduler
scheduler.addMarkedTimespan({
start_date: new Date(2013,11,29,01,00),
end_date: new Date(2013,11,29,01,10),
css: "inprocess",
sections: {
unit: 'a7b6e635-f62f-6f12-020f-52a959d1ca47'
}
});
// This is how I'm showing appointments on scheduler
scheduler.config.multi_day = true;
scheduler.init('scheduler_here',new Date(2013,11,29),"unit");
scheduler.parse([{"start_date":"2013-12-29 01:13","end_date":"2013-12-29 01:23","text":"<div style='float: left;'>Booked<\/div><div style='float: right;
scheduler.updateView();
The sections which are inprocess I wish to update per five seconds which is why I have call setInterval. Im getting same data in json as inprocess from setInterval. I wish to update that particular section. It could be add more block area which are in process or remove existing blocks.
Well I already know how can I add more blocks, I'm stuck at how can I remove existing block areas/in process areas.
*I don't want to update whole sections for that.
Check the deleteMarkedTimespan method. It takes the same parameters as .addMarkedTimespan and can be used to remove marked/blocked areas from specific times. You can test it on this sample page
execute following code in browser console, it should remove a part of marked area on Monday of the initial week:
scheduler.deleteMarkedTimespan({
start_date: new Date(2012, 7, 6, 0),
end_date: new Date(2012, 7, 6, 3)
});
scheduler.updateView();//redraw the scheduler
related docs: http://docs.dhtmlx.com/scheduler/limits.html#removingmarkingblocking