Scheduler Event capture issues

I have my scheduler up and running and it runs well for the most part. What I am noticing is that sometimes when I add or edit a task and then add or edit another task without doing a hard browser refresh the first edit does send an event but the second one doesn’t. Hence the second add/edit isn’t updated in my database. It’s almost as if it is a cacheing issue from the browser side of things. I was wondering if you have had this issue and if you have any suggestions.



I am using the scheduler_connector and a php page with some methods that generate custom sql for updating, deleting and inserting data. When the events.php page is called (which it ALWAYS is on a hard refresh) the functions work well and the db gets updated. However, the issue is that occassionally (as described above) the events.php does not get called on the second and subsequent adds or edits.



I hope this makes some sort of sense?



I have included some code below which might help. Let me know if there is something I can do to force the events.php page to be run every time an item is added or edited or a way to require a hard refresh after each add or edit.



Thanks so much for the help you folks provide.



Jen





function init() {

scheduler.config.xml_date="%Y-%m-%d %H:%i";

scheduler.config.lightbox.sections=[

{name:“description”, height:42, map_to:“text”, type:“textarea” , focus:true},

{name:“details”, height:130, type:“textarea”, map_to:“cal_event_desc” },

{name:“time”, height:72, type:“time”, map_to:“auto”},

{name:“priority”, height:42, width:150, type:“select”, map_to:“cal_event_priority”,

options:[

{key:1, label:“Normal”},

{key:2, label:“Moderate”},

{key:3, label:“Critical”}

]

},



… more configuration code here …



scheduler.config.first_hour=8;

scheduler.config.hour_date="%h:%i %A";

scheduler.locale.labels.section_description=“Event Title”;

scheduler.locale.labels.section_details=“Event Details”;

scheduler.config.details_on_create=true;

scheduler.config.details_on_dblclick=true;

scheduler.locale.labels.section_priority=“Event Priority”;

scheduler.locale.labels.section_is_recurring=“This event reoccurs…”;

scheduler.locale.labels.section_recurrence_span=“For the next…”;

scheduler.locale.labels.section_has_reminder=“Email me a reminder of this event…”;



scheduler.locale.labels.task_tab=“Task List”;

scheduler.locale.labels.search_tab=“Search”;



scheduler.update_viewA=scheduler.update_view;



scheduler.update_view = function(){

if (this._mode==“task”)

window.location="/tasklist/index";

else if (this._mode==“search”)

alert(“Date:”+this._date+", mode:"+this._mode+" search page will show up on this tab");

else return this.update_viewA();

}



scheduler.init(‘scheduler_here’,null,“week”);



scheduler.templates.event_class=function(start,end,event){

if (event.cal_event_priority == 1) //if date in past

return “priority_one_event”; //then set special css class for it

else if (event.cal_event_priority == 3) //if date in past

return “priority_normal_event”; //then set special css class for it

else if (event.cal_event_priority == 2) //if date in past

return “priority_medium_event”; //then set special css class for it

}



scheduler.load("/media/dhtmlx/dhtmlxScheduler/samples/events.php?user_id={/literal}{$user_id}{literal}&uid="+scheduler.uid());



var dp = new dataProcessor("/media/dhtmlx/dhtmlxScheduler/samples/events.php?user_id={/literal}{$user_id}{literal}");

dp.init(scheduler);





a) Please enable server side logging ( or client side, by using debug version of js file ) and check
- is request for data saving not sent for sure
- is operation, previous to incorrect one , returns correct response from server side.

b) Insert operation on server side - it it done automatically, or you have redefine it through events or custom sql? In such case you need to be sure, that after custom insert processing, the next statement executed
$action->success($new_id);
where $new_id - id of newly added row. Without such code - client side will not receive new ID of element, and all further updates of such event will not be saved in DB correctly.
( this not necessary if you are using automatic insert processing )

I have enabled server side logging… that is how I know the event is not being received.  So for the $action… do I add that to the php code in my events.php custom code or somewhere in one of your php modules?

So for the $action
You can add it the the your connector configuration code.
It need to be done only if you are using custom logic for insert actions

function my_code($action){
$action->success($new_id);
}
$sched->event->attach(“afterInsert”,“my_code”);
$sched->render_…