how do i use scheduler.changeEventId(id, newId); in mobile scheduler?
i also need to update the items values. without showing the editForm.
how do i use scheduler.changeEventId(id, newId); in mobile scheduler?
$$(“scheduler”).data.changeId(id,newId);
i also need to update the items values. without showing the editForm.
$$(“scheduler”).item(id).text = “my event”;
$$(“scheduler”).refresh();
I’m trying to do this as well. We edit events outside of mobile.
My process is this:
- click the event (goes to “preview” screen)
- click a custom button that allows me to edit the event
- now I want to refresh the event.
I’ve tried several things including what you recommend here.
$$("scheduler").load('...url?q='+id,"scheduler");
$$("scheduler").item(id).text = "my event"; //shouldn't be necessary, but I thought I'd try
$$("scheduler").refresh();
Even without the other two lines, I know the “load” is working because the changed event shows up when I click “back” to the list view.
Can you tell me how refresh the Preview?
Thank you.
Try to call refresh with id parameter:
$$(“scheduler”).item(id).text = “my event”;
$$(“scheduler”).refresh(id);
Hmm. Your suggestion works if I really knew the text of the event. Since I don’t, it’s not only rendering the page, but saving “my event” back to my database (probably because I’m using the ‘save’ property in my scheduler definition).
I’ll describe what I’m looking for (apologies to wuhi - I didn’t mean to take over this thread):
I’m updating the data outside of scheduler, then I want to refresh my window with the new current data. I have a server side script that will return the scheduler data for a single event. (the url is “thestring” variable).
First I call:
$$(“scheduler”).load(thestring,“scheduler”);
This seems to load the new data correctly from my datasource, because clicking the back button shows the correct data in list view. However the data is still wrong in the preview view.
So then I try the refresh, after the load command:
$$(“scheduler”).refresh(event_id);
This seems to not only reload OLD data, but is also writes the old data back again to my data source. So the new data retrieved during the load command is lost.
Is there a single command that will just update the preview screen with the data that I’ve already loaded?
$$(“scheduler”).refresh(event_id); should be called after xml is loaded:
$$("scheduler").load(thestring,"scheduler",function(){
var eventId = $$("scheduler").getCursor(); // an active event id
$$("scheduler").refresh(eventId);
});
Awesome - that worked great. I didn’t know there was a callback for this function.
Thank you so much.
I am trying to mimic a lot of behavior that I’ve set up in the desktop version of Scheduler. Is there any sort of cross reference showing what settings in Mobile correspond to which settings in Desktop? It seems tricky to find documentation for settings for Mobile, since so much of it is documented as part of the Touch documentation, and I can’t always tell what applies to Mobile Scheduler.
OK, one more followup:
What attachEvent can I wrap this in, so that every time I edit data in the Form View, then click Save, the data is refreshed from the database using this function.
I’d like to update my calendar with most recent data from the database every time an event is updated, added and deleted.
I’ve tried the following, but I end up in a continuous loop of server activity - post change to server, get data from server, post to server again, and so on.
Here’s the code I’m currently using:
$$("scheduler").data.attachEvent("onStoreUpdated",function(id,item,operation){
if(operation == "update"){
thestring = "serverquery.php?queryid="+id;
$$("scheduler").load(thestring,"scheduler",function(){
$$("scheduler").refresh(id);
});
}
});
I’ve tried “return false” and “eventblock” but I can’t seem to get it right.
Thank you for your help.
Scheduler uses DataProcessor to send the server. Therefore, you may use its events to call the necessary functions after update, delete or insert requests.
In case of “update” you may use something like so:
dhx.dp($$(“scheduler”)).attachEvent(“onAfterUpdate”,function(obj){
thestring = “serverquery.php?queryid=”+obj.tid;
$$(“scheduler”).load(thestring,“scheduler”,function(){
$$(“scheduler”).refresh(id);
});
});
I tried this and the same result. It appears to be the refresh(id) function that triggers the load function to run again.
I am using a beta build of mobile 2012 June 08.
If I remove the refresh(), the loop doesn’t happen. Of course, the event display doesn’t update either.
Yes, refresh(id) causes dataProcessor update. Sorry for the misleading information ((
Try to use refresh() without parameters
Hi Alexandra -
This is still not working. I’ve upgraded to the latest mobile version to see if it’s working there. (120626).
I’m using the following code:
dhx.dp($$(“scheduler”)).attachEvent(“onAfterUpdate”,function(obj){
thestring = “serverquery.php?queryid=”+obj.tid;
$$(“scheduler”).load(thestring,“scheduler”,function(){
$$(“scheduler”).refresh();
});
});
When I touch an event, it goes to the “preview” screen.
Then I touch “Edit”. I make my change. Then touch “Save”
This saves data to the server, then retrieves from the server.
If I use $$(“scheduler”).refresh() without the id, the preview screen does not reflect the updated record (clicking “back” to the month view shows the updated data).
If I use $$(“scheduler”).refresh(id) WITH the id, the preview screen is updated, but I am stuck in a loop of continuous updates.
Please help. I believe this is the last issue before I deliver this to my client.
Thank you.
Ken
Hi Ken,
Please try the following (clearAll() method and restoring cursor):
dhx.dp($$("scheduler")).attachEvent("onAfterUpdate",function(obj){
var cursor = $$("scheduler").getCursor();
$$("scheduler").clearAll();
thestring = "serverquery.php?queryid="+obj.tid;
$$("scheduler").load(thestring ,"scheduler",function(){
$$("scheduler").setCursor(cursor);
});
});
Although this does correctly update the event preview, the intent was to just update the one event and re-display it. Your solution clears the entire calendar, and requires me to reload the entire calendar.
Is there any way to just refresh the current preview without triggering additional updates?
Thanks
Ken
In this case, use $$(“scheduler”).setCursor(null); instead of clearAll:
dhx.dp($$("scheduler")).attachEvent("onAfterUpdate",function(obj){
var cursor = $$("scheduler").getCursor();
$$("scheduler").setCursor(null);
thestring = "serverquery.php?queryid="+obj.tid;
$$("scheduler").load(thestring ,"scheduler",function(){
$$("scheduler").setCursor(cursor);
});
});