I have been updating my scheduler for recurring events and I have a few questions.
Note: I am using JSON to send the event information from the client to/from the server.
The server is Java using Spring MVC and Hibernate.
Do I need to store (in additional to the basic information) ‘rec_pattern’ in the database and return it to the client or only store
‘rec_type’ / ‘event_length’ / ‘event_pid’ ?
I understand that extra server side logic is needed based on the following text.
if event with rec_type==none wad inserted - response must have “deleted” status
if event with rec_type was updated or deleted - all records with event_pid equal to the master id must be deleted
if event with event_pid value was deleted - it need to be updated with rec_type “none” instead of deleting.
But what does ‘response must have “deleted” status’ mean on case 1 ?
‘rec_type’ / ‘event_length’ / ‘event_pid’ is enough.
When we have recurring event (say everyday) and we want to delete just one of them then actually we need to insert 1 record into the database but delete that event on client side.
DHTMLX data processor would delete event if ‘deleted’ status is returned but as you don’t use it then you simply need to implement logic described above.
I am just implemented the server/client side logic for this and have a few other questions.
Note: I am using JSON to send the event information from the client to/from the server.
The server is Java using Spring MVC and Hibernate.
A) For the code below I am not sure where to place the equivalent logic inside the set of scheduler events itself.
Would it be ok to used onEventChanged for “updated” and onBeforeEventDelete for “deleted” ?
or should “beforeProcessing” happen earlier in the logic flow – if so on what ‘event’ ?
That’s server side code. So just before processing your request you need to execute same code as in “delete_related” function.
For example you have series of recurring events which happen everyday. You want to delete just one of them. On the client side internally you simply need to delete it but on the server side - add additional record. So I believe you should use onBeforeEventDelete to send such request to the server.
1) When I delete an individual event I am seeing onEventAdded called and an event added with rec_type = none.
However I am not seeing the ‘lightbox’ being deleted – unlike the ‘delete all occurrences’ case.
Please provide your onBeforeEventDelete handler. Most likely you are adding there event with addEventNow function, try using addEvent. addEvent doesn’t display lightbox (which was causing your issues) and simply creates event.
function senddeleteevent(id,url){
convert_date_time = scheduler.date.date_to_str("%Y-%m-%d %H:%i");
var req = new XMLHttpRequest();
req.open('POST', url , false);
req.setRequestHeader("Content-Type","application/json");
req.setRequestHeader("Accept","application/json");
var event = scheduler.getEvent(id);
// Copy event so can do time conversion without corrupting original start / end times.
var event_copy = {
text: event.text,
start_date: convert_date_time(event.start_date),
end_date: convert_date_time(event.end_date),
rec_type: event.rec_type,
pid: event.event_pid,
length: event.event_length
};
var string = JSON.stringify(event_copy);
req.send(string);
if (req.status != 200) {
alert("Error sending data to network - Delete");
return false;
}
return true;
};
I am sorry, checked the code, actually it’s native recurring code creates new event:
[code]scheduler.attachEvent(“onBeforeEventDelete”,function(id){
var ev = this.getEvent(id);
if (id.toString().indexOf("#")!=-1) {
var id = id.split("#");
var nid = this.uid();
…
return true;
});[/code]
Can you please use replace your current dhtmlxscheduler_recurring.js file with the recurring.js from the sources folder? It’s uncompressed version, would be easier to debug this issue.
It seems you haven’t actually replaced the file or it was cached. Try clearing the cache and make sure that you have replaced file and includes on the page are correct (points to the new file).
The goal here is to understand where exactly problem lies.
I have replace the file (with recurring.js) but now I do not even get as far as before I get
‘repeat event’ undefined in the lightbox when opened and you cannot click on ‘disabled’ to make it ‘enabled’.
All I have changed is I have replaced the original dhtmlxscheduler_recurring.js with the one from the ‘source’ directory.
Tried that file but same problem I get the following in firebug on opening lightbox with either the source version or your version.
I do not get this problem with the compressed version.
Can’t tell you what is wrong for now, can you please make your sample available on the internet or create complete demo I would be able to run locally?
If you are familiar with debugging using firebug when put debugging point in the ‘onBeforeEventDelete’ event and check what’s happening there.
At present my application is not available on the internet - though I could have a trial version very soon however I have had a look at Firebug and been able to get the stack trace.
I hope this is of use.
ev is undefined
_add_rec_marker()dhtmlx...ring.js (line 250)
ev = undefined
time = 1306894200000
(?)()dhtmlx...ring.js (line 298)
id = ["6", "1306894200"]
dhtmlx()dhtmlx...uler.js (line 9)
dhtmlx()dhtmlx...uler.js (line 9)
name = "ev_onbeforeeventdelete"
arg0 = ["6#1306894200", Object { start_date=Date, end_date=Date, more...}]
loadUpdate()dhtmlx...uler.js (line 39)
C = "6#1306894200"
A = undefined
loadUpdate()dhtmlx...uler.js (line 39)
B = "6#1306894200"
loadUpdate()dhtmlx...uler.js (line 39)
C = click clientX=581, clientY=94
ev._pid_time = time;