Hello,
I have modified the mobile scheduler so it can be used offline.
The problem i now have is when i want to insert, update or delete an event.
I’m using the following code to initialize the scheduler:
dhx.ui({
view: "scheduler",
id: "scheduler",
save: "/Mobile/schedule_mobile_SaveData.aspx"
});
I save events using my own code located in schedule_mobile_SaveData.aspx.
When saving this way i have to send the following response to the client after saving the event:
<data>
<action type='added/updated/deleted' sid='1' tid='1'></action>
</data>
This works.
When the client is not online i’m saving offline (using the events onbeforeadd, onbeforeupdate, onbeforedelete).
This way i can save the data offline and when the user comes back online i can send the data to the server to really save the data.
The problem here is that the scheduler still sends a request to my save page (schedule_mobile_SaveData.aspx) and expects a response of it.
This obviously fails.
The first add/update/delete always works. The second time i want to add/update/delete something, i get the error date.getFullYear is not a function.
I think this is because the scheduler didn’t get a response from the server.
(i think this because when i’m saving online and i’m not sending a response i get the same error).
Is there a way to tell the scheduler to not send a request to the server so that i won’t get this error?
CompuFit
Next code will block data sending and inform data processor that actions successfully finished.
dp.attachEvent("onBeforeDataSending", function(id, mode){
window.setTimeout(function(){
dp.afterUpdateCallback(id, id, mode);
dp.finalizeUpdate();
},100);
return false;
});
Hello,
I don’t use a dataprocessor to load and save data.
To save and load i use my own asp.net code.
Example:
$$("scheduler").load("Mobile/schedule_mobile_LoadData.aspx", "json");
That way i can’t use your solution with the dataprocessor.
Luckely i have found my own solution.
The problem with the offline save occurred when using the following code:
dhx.ui({
view: "scheduler",
id: "scheduler",
save: "Mobile/schedule_mobile_SaveData.aspx"
});
When i save an appointment using this method the scheduler sends a request to the server and expects a response. When he doesn’t get a response i get the error “date.getFullYear is not a function” on the next save.
This was a problem for me when i wanted to save offline.
To solve this problem i removed the save in the previous code.
All the code to save an appointment online and offline is now in the scheduler event “onStoreUpdated”.
In this event i check if the user is online or offline.
When the user is offline i save offline so when the user comes back online the data is send to the server.
When the user is online i send my own request to the server (using ajax) with in the body of the request the data of the appointment. Then i save the appointment on the server using my own asp.net code. When i have saved the appointment on the server i send a response back to the scheduler with the old and new id.
When the response gets to the scheduler i just have to change the old id of the appointment (generated by the scheduler) into the new id of the appointment.
This has cost me a lot of time to find, but eventually i found out how to do it.
The following code changes the id of the appointment:
$$("scheduler").data.changeId(sid, tid);
$$("scheduler").$$("calendarDayEvents").data.changeId(sid, tid);
$$("scheduler").$$("dayList").data.changeId(sid, tid);
$$("scheduler").$$("list").data.changeId(sid, tid);
Using this method i can now save online and offline.
CompuFit
I think i have the same problem can you please send me the code that you have changed so i can give your implementation a try would be super if you can send me all the methods you changed sorry for bugging but i am quite new to java script and ajax thing