showLightbox for series

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

I’m open to other suggestions about updating/deleting whole series. How can i do that? A simple showLightbox(id_of_parent_event) in Chrome dev console opens the modal as expected but same error occurs when i hit save button. It has something to do with visible events. I think…

I didn’t solve it…I just made a workaround. I can’t paste the code here because it’s late and I’m home now :slight_smile: but…
On my modal, when I open a “child event”, I have a checkbox “Edit series”. Clicking on that checkbox resets my modal with the parent event. When that checkbox is checked I detect it on my “save_form” function and at the very end I do something like
if(document.getElementById(‘edit_all’).checked){
scheduler.updateEvent(ev.id); // this updates the event on scheduler client side
$.post(‘someurl’,{‘ev’:ev},function(){ // here i update my event on server side (keep in mind all situations for recurring events…) not with connector.
return false;
}
}else{
scheduler.endLightbox(true); // single occurrence of that event are saved ok with scheduler connector server side
}
I don’t remember if I missed something but I will post again on monday.