Strange behaviour when saving data from custom lightbox

Hey,

I am trying to save event data objects created by my own custom lightbox using the method

scheduler.endLightbox(true, document.getElementById(‘calendar_lightbox’));

This works fine:
I try to add a new event by having the following event data object (created by my custom lightbox) ready before calling the scheduler.endLightbox() method:

({start_date:(new Date(1416817800000)), end_date:(new Date(1416831300000)), text:“new entry”, id:1417265477871, _timed:true, _sday:0, _inner:false, _sorder:0, _count:1, event_pid:"", event_length:"", rec_pattern:"", rec_type:"", additionalinfo:"", calendarID:“1”, color:"#80ff00"})

This works fine too:
I try to change the event by having this event data object ready when calling the scheduler.endLighbox() method:

({start_date:(new Date(1416817800000)), end_date:(new Date(1416827700000)), text:“new entry”, id:“43”, _timed:true, _sday:0, _inner:false, _sorder:0, _count:1, event_pid:"", event_length:"", rec_pattern:"", rec_type:"", additionalinfo:"", calendarID:“1”, color:"#80ff00", ‘!nativeeditor_status’:"", _text_style:“font-weight:normal;text-decoration:none;”})

Even this works fine:
This time I want to add a recurring event:

({start_date:(new Date(1416986100000)), end_date:(new Date(1456786800000)), text:“new entry”, id:1417265477872, _timed:true, _sday:2, _inner:false, _sorder:0, _count:1, event_pid:"", event_length:9600, rec_pattern:"", rec_type:“week_1___1,2,3,4,5#no”, additionalinfo:"", calendarID:“1”, color:"#80ff00"})

BUT:
if I want to CHANGE an EXISTING (rather than creating a new event) to be a RECURRING event, or change the data of an already existing recurring event by using this event data object:

({start_date:(new Date(1416986100000)), end_date:(new Date(1456786800000)), text:“new entry”, id:“44”, _timed:true, _sday:2, _inner:false, _sorder:0, _count:1, event_pid:"", event_length:9600, rec_pattern:“week_1___1,2,3,4,5”, rec_type:“week_1___1,2,3,4,5#no”, additionalinfo:"", calendarID:“1”, color:"#80ff00", ‘!nativeeditor_status’:"", _text_style:“font-weight:normal;text-decoration:none;”})

then the end_date parameter seems to be set to “undefined” (which makes the whole event disappear) by the scheduler.endLighbox() method. Also the event_length parameter gets messed up. Here is what the scheduler transfers as post parameters to the server:

POST:
43_start_date: 2014-11-24 09:30
43_end_date: undefined
43_text: new entry
43_id: 43
43_event_pid:
43_event_length: 39969000
43_rec_pattern:
43_rec_type: week_1___1,2,3,4,5#no
43_additionalinfo:
43_calendarID: 1
43_color: #80ff00
43_!nativeeditor_status: updated
ids: 43

Any idea what is my problem here? I just don’t get it…

Thanks,
Benedikt.

Hello,
i couldn’t reproduce the problem so far.
Here is what i’ve tried

  1. open this example -
    docs.dhtmlx.com/scheduler/sample … vents.html
  2. double click on empty cell to create a single event
  3. check the id of new event and update it to the recurring event:

scheduler.addEvent({ "id":"81",//id of the added event "start_date":new Date(2010,9,12,21), "end_date":new Date(2012,10,12,0), "text":"New event - RECURRING", "event_pid":"", "event_length":1800, "rec_type":"week_1___1,2,3,4,5#no" })
So modifying the regular event into recurring series seems to work correctly, the http values are also seems valid. Can you provide a complete demo where the problem can be reproduced

Try to do the next, if you are saving recurring event through the custom lightbox

obj.start_date - start of first event in series
obj.end_date - end of first event in series
obj._end_date - end of series itself

Hello,
now I managed to set up an example where the behaviour can be reproduced.
Please go to:
test.two-wings.net

Then add an event and save it. Next edit the same event again and make it a recurring event.
No matter what you do, the event will disappear.

BUT, if you add an event and make it recurring in one go (without saving it and coming back again to edit it), the recurring controls function perfectly.

Best Regards,
Benedikt.

Hello,

I tried Stanislavs suggestion and made ev._end_date the end of the series while leaving ev.end_date alone (being the end of the first occurrence). But now I have the opposite problem:

  • If you want to add a new event and make it recurring, it does not work (it stays a single event).
  • If you open the lightbox of this event again and make the event recurring, it works.

Additionally the number of occurrences saved in the “extra” part of rec_type now does not seem to have any effect. (I set the ev._end_date to a distant date in the future when this option is chosen.)

I have made the adjustments to my example at test.two-wings.net

And I have to say, that I do not understand the logic behind ev._end_date and ev.end_date. I thought the parameter ev.event_length sets the end of each occurrence. Having ev.end_date to be the end date of the first occurrence seems to be a redundant information to me. Also the data processor still sees ev.end_date as the end of the series.

Can you help me to understand that? Thanks in advance.

Best Regards,
Benedikt.

I am now convinced that this is a bug in the software.

Adding a new recurring event (which fails to display correctly in the calendar), I am sending this event object:
({start_date:(new Date(1418628300000)), end_date:(new Date(1418634600000)), text:“new entry”, id:1418628640611, _timed:true, _sday:0, _inner:false, _sorder:0, _count:1, event_pid:"", event_length:6300,
rec_pattern:“week_1___1,2,3,4,5”, rec_type:“week_1___1,2,3,4,5#no”, additionalinfo:"", _end_date:(new Date(4076002800000))})

Changing an existing event to a recurring event (which then displays correctly in the calendar), I am sending the exact same event object:
({start_date:(new Date(1418628300000)), end_date:(new Date(1418634600000)), text:“new entry”, id:1418628640611, _timed:true, _sday:0, _inner:false, _sorder:0, _count:1, event_pid:"", event_length:6300,
rec_pattern:“week_1___1,2,3,4,5”, rec_type:“week_1___1,2,3,4,5#no”, additionalinfo:"", _end_date:(new Date(4076002800000))})

So I think there is no way, that I made a mistake somewhere.

Changing an existing event to a recurring event
({ id:14186286406

It looks as auto-generated ID which is not expected to be here for update operations. Such id is generated just after new event creation and must be replaced with real db ID after initial data saving. So if you already have saved with event to DB and just updating it - ID must look differently.

This implementation is without any database backend, that’s probably why the ID is the same for the update as for the insert event operation. It’s my dummy page at:
test.two-wings.net

Just try yourself.

Best Regards,
Benedikt.

As far as I can see, while saving recurring events it doesn’t set the end-date to the end of last recurring event in the series, as it do the standard recurring form. That is why the result event rendered as not recurring one.

For recurring event

start_date - start of first event in series
end_date - end of last event in series ( some distant future for events without end date )
event_length - length of single event instance

Stansilav,

I am confused. May I cite you:

That is what I did. Now you write:

Which one is correct?