I have a custom modal that i use instead of the lightbox.
I use this code to acces it:
scheduler.showLightbox = function (id) {
var ev = scheduler.getEvent(id);
scheduler.startLightbox(id, null);
// here i populate all form fields with values from my “ev” object including 2 bootstrap datepickers for start_date and end_date.
And last:
$(’#myModal5’).modal(‘show’);
}
After this i save the event like so:
function save_form() {
var ev = scheduler.getEvent(scheduler.getState().lightbox_id);
ev.text = document.getElementById("project_name").value;
// and all other ev properties including
ev.rec_type = rec_type; // hardcoded week_1___1,2,3,4,5
ev.event_pid = 0;
ev.event_length = event_length; // hardcoded 21600
And end this function loke so:
$(’#myModal5’).modal(‘hide’);
scheduler.endLightbox(true);
Everything works fine for now, event is displayed perfectly and i can edit single occurances of the series but… I can’t acces the little popup that asks if i want to edit single event or series (ok…no prob) so i made a button on my modal and bind this to it:
$(‘body’).on(‘click’,’#edit_all’, function(){
console.log(‘reset lightbox’);
scheduler.resetLightbox();
// scheduler.endLightbox(false);
setTimeout(function(){ scheduler.showLightbox(101);}, 100); // I hardcoded the id of the event wich is the series “parent”
setTimeout(function(){ scheduler.startLightbox(101,null);}, 500); // I hardcoded the id of the event wich is the series “parent”
});
Notice that i tried various combinations of start/show/end/etc and added some timeouts there…
My modal gets updated beautifuly when i hit the “edit all series button” with the properties of the “parent event”, but when i hit “Save event” i get an error:
Uncaught TypeError: Cannot read property ‘valueOf’ of undefined
at Object.scheduler.is_visible_events (dhtmlxscheduler.js:4526)
at Object.scheduler.is_visible_events (dhtmlxscheduler_units.js:194)
at Object.scheduler.event_updated (dhtmlxscheduler.js:4519)
at Object.scheduler._set_event_text_style (dhtmlxscheduler.js:7014)
at dataProcessor.markRow (dhtmlxscheduler.js:1537)
at dataProcessor.setUpdated (dhtmlxscheduler.js:1522)
at Object. (dhtmlxscheduler.js:6935)
at Object.z [as ev_oneventchanged] (dhtmlxscheduler.js:944)
at Object.obj.callEvent (dhtmlxscheduler.js:932)
at Object.scheduler._edit_stop_event (dhtmlxscheduler.js:5479)
Note: If i hardcode an id of an event that is part of the series (one that is created when i update an ocurance), i don’t get the “end_date” error.
Also when i console.log my ev on the “save_form” function i can see the end_date when the object is not collapsed but it’s undefined when i collapse it. If i console.log ev.end_date i get a correct date. This does not happen for start_date.
Thank you