Scheduler display problems

I have a few problems I am hoping you can help with.

Summary of usage.

I am using the scheduler to capture and display events.

I am using a JSON interface between the Javascript and the network server.

I have - scheduler.config.details_on_create = true;

  1. Firefox/IE.

While my events trigger - to send the JSON information - on onEventAdded and onEventChanged on pressing the ‘save’ button the event disappears from the display.

(If I reload the page in Firefox the events are downloaded from the server and displayed).

  1. IE.

While the events are stored on the network server a refresh on the page does not display the events.

In fact with IE there seems to be a lag in updating the display at all – the Javascript seems to be remembering old screen settings even after a refresh.

  1. Firefox.

If I ‘edit’ the event – then ‘detail’ the event and then ‘save’ it – the whole screen locks up.

Thanks for any help.

Hello,

You must have changed original event properties in your handler making them incorrect (most likely start/end dates).

IE tends to cache xml, json files. Be sure that every request have additional unique property, e.g.:
events.xml?uid=3495892839
where uid is unique number.

Can you please give us a link to your sample so we could check it?

Best regards,
Ilya

Thanks for the answers.

On 1) I have the following code.

The rational behind this was that I wanted the JSON start / end dates to be in the form returned on the ‘load’ eg. start_date:“2009-7-1 6:00” and I did not want the extra internal date being sent in the JSON.

I thought in answer to another forum question I was told this editing was ok but perhaps I have misunderstood.

So how would this be achieved without affecting the ‘event’ ?

Note: I am new to Javascript so I apologise if this is obvious.

scheduler.attachEvent("onEventAdded", function(event_id,event_object){
                                    sendaddevent(event_id,’/AddEvent.json?userid=${user.id}');
                                   return true;   
                                  });
function sendaddevent(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);
	     
	     event.start_date = convert_date_time(event.start_date);
     	 event.end_date = convert_date_time(event.end_date);

     	 delete event._inner;
     	 delete event._sday;
     	 delete event._timed;
     	 delete event._sorder;
     	 delete event._count;
     	 
		 var string = JSON.stringify(event);
		  
		 req.send(string);   

		 var responseString = req.responseText;

		 var newEvent = JSON.parse(responseString);  

		 scheduler.changeEventId(event.id,newEvent.id);

		 return true; 		     
		};

On 2) Are you talking about something unique for each request ?

For example I have:

 scheduler.load(“/ListEvents.json?userid=${user.id}","json");

but this would be the same for each request for that user.

Is there a way to get the Javascript to generate this unique number across requests ?

On 3) my website is not on the public internet at present – I will see if when I fix the above it is solved.

  1. I have also notice another issue.
    In firefox if I take an event and ‘edit’ it – then ‘delete’ it – ‘onEventChanged’ is called not on ‘onBeforeEventDelete’ so I do my change logic to the server not my ‘delete’ logic.

Sorry I have so many questions and thanks for any help provided.

On 2) I have used ‘&uid=’+ new Date().getTime() and this seems to work

Hello,

It’s ok to edit event properties except start and end dates. When scheduler loads events it converts strings with dates (e.g. “2011-05-35 15:56”) to javascript Date objects and works with from that point.
You need to create copy of event and work/stringify it:

... var event = scheduler.getEvent(id); var event_copy = { text: event.text, start_date: convert_date_time(new Date(event.start_date)); // new date object, old one is preserved end_date: convert_date_time(new Date(event.end_date)); } // note that in such case you don't need to delete unnecessary fields but have to list fields you are actually want to send to the server var string = JSON.stringify(event_copy); req.send(string); ...

scheduler.load(“/ListEvents.json?userid=${user.id}&tid="+scheduler.uid(),"json");

Best regards,
Ilya

Thanks - I will give this a go.

Any view on comment 4 ?

  1. I have also notice another issue.
    In firefox if I take an event and ‘edit’ it – then ‘delete’ it – ‘onEventChanged’ is called not on ‘onBeforeEventDelete’ so I do my change logic to the server not my ‘delete’ logic.

By using your solution with a few edits 3 and 4 go away - thanks.

Edits: I have not 'new’ed the Date.

     The ';' at the end on the line becomes ','