Bug: Serialize does not properly serialize recurring events

dhtmlscheduler_serialize (scheduler.toJSON, .toXML, .toICal) does not properly serialize recurring events when non-recurring events are also in schedule.

The “event_pid”, “event_length”, “rec_pattern”, and “rec_type” fields are missing.

*Note, the 3rd event below is the recurring event.

scheduler._events
Object {1375914103171: Object, 1375914103172: Object, 1375914103173: Object, 1375914103173#1375984800: scheduler._copy_dummy, 1375914103173#1376071200: scheduler._copy_dummy, 1375914103173#1376589600: scheduler._copy_dummy, 1375914103173#1376676000: scheduler._copy_dummy, 1375914103173#1377194400: scheduler._copy_dummy…}
1375914103171: Object
_eday: 3
_first_chunk: true
_last_chunk: true
_length: 1
_pid_time: NaN
_sday: 2
_sorder: 0
_sweek: 1
_timed: true
end_date: Wed Aug 07 2013 16:21:00 GMT-0700 (PDT)
id: 1375914103171
start_date: Wed Aug 07 2013 14:21:00 GMT-0700 (PDT)
text: “Meeting with a longer name than normal”
proto: Object
1375914103172: Object
_eday: 3
_first_chunk: true
_last_chunk: true
_length: 1
_pid_time: NaN
_sday: 2
_sorder: 1
_sweek: 1
_timed: true
end_date: Wed Aug 07 2013 17:21:00 GMT-0700 (PDT)
id: 1375914103172
start_date: Wed Aug 07 2013 16:21:00 GMT-0700 (PDT)
text: “Another meeting with a long name that is long”
proto: Object
1375914103173: Object
_eday: 4
_end_date: Mon Feb 01 9999 00:00:00 GMT-0800 (PST)
_first_chunk: true
_last_chunk: true
_length: 1
_pid_time: NaN
_sday: 3
_sorder: 0
_start_date: Mon Aug 05 2013 00:00:00 GMT-0700 (PDT)
_sweek: 1
_timed: true
end_date: Mon Feb 01 9999 00:00:00 GMT-0800 (PST)
event_length: 3600
event_pid: “”
id: 1375914103173
rec_pattern: “week_1___4,5”
rec_type: “week_1___4,5#no”
start_date: Mon Aug 05 2013 11:00:00 GMT-0700 (PDT)
text: “New event”
proto: Object

scheduler.toJSON()
“[{ “text”: “Meeting with a longer name than normal” , “start_date”: “08/07/2013 14:21” , “end_date”: “08/07/2013 16:21” , “id”: “1375914103171” },
{ “text”: “Another meeting with a long name that is long” , “start_date”: “08/07/2013 16:21” , “end_date”: “08/07/2013 17:21” , “id”: “1375914103172” },
{ “text”: “New event” , “start_date”: “08/05/2013 11:00” , “end_date”: “02/01/9999 00:00” , “id”: “1375914103173” }]”

scheduler.toXML()


<start_date></start_date>
<end_date></end_date>




<start_date></start_date>
<end_date></end_date>




<start_date></start_date>
<end_date></end_date>

scheduler.toICal()
“BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//dhtmlXScheduler//NONSGML v2.2//EN
DESCRIPTION:
BEGIN:VEVENT
DTSTART:20130807T142100
DTEND:20130807T162100
SUMMARY:Meeting with a longer name than normal
END:VEVENT
BEGIN:VEVENT
DTSTART:20130807T162100
DTEND:20130807T172100
SUMMARY:Another meeting with a long name that is long
END:VEVENT
BEGIN:VEVENT
DTSTART:20130805T110000
DTEND:99990201
SUMMARY:New event
END:VEVENT
END:VCALENDAR”


As fast solution, add code like next to the scheduler’s initialization

[code]scheduler.data_attributes=function(){
return [
[“text”],
[“start_date”, scheduler.templates.xml_format],
[“end_date”, scheduler.templates.xml_format],

        ["event_length"],
        ["event_pid"],
        ["rec_pattern"],
        ["rec_type"]
  ];

};[/code]

You can use similar approach to add any other custom attributes to the serialization.

docs.dhtmlx.com/scheduler/export … ringevents

Thanks Stanislav, will give this a try.