Scenario: Events are not updating once they have been inserted/updated via ajax.
Reproduction Scenario 1: Create a new event, then update the event duration or date by dragging. Refresh the page and notice that the insert worked, but subsequent updates did not occur.
Reproduction Scenario 2: Create a new event, refresh the page. Update the event duration or date by dragging. Update the event duration or date again by dragging. Refresh the page and notice that only the first update was applied.
Possibly Related: viewtopic.php?f=25&t=29402&start=0&hilit=not+saving
Environment: Firefox / VS 2010 / ASP.NET MVC 4
What is occurring while debugging the back end (simply put) is the subsequent updates are not firing the configured custom save. Here is the source:
---- CSHTML -------------------------------------------------------------------------------------------
@{
Layout = “/Views/Shared/_Layout.cshtml”;
}
---- Rendered View (abbrv) -----------------------------------------------------------------------
</div><script>
scheduler.config.serverLists = {};scheduler.serverList(“sl_1_635077644160137899”, [{“key”:"#9fc6e7",“label”:“Meeting”},{“key”:"#7bd148",“label”:“Event”},{“key”:"#fbe983",“label”:“Personal”},{“key”:"#ffad46",“label”:“Follow up (Deadline)”}]);
scheduler.locale.labels.section_text = ‘Title’;
scheduler.locale.labels.section_description = ‘Description’;
scheduler.locale.labels.section_location = ‘Location’;
scheduler.locale.labels.section_color = ‘Event Type’;
scheduler.locale.labels.section_time = ‘Time’;
scheduler.config.lightbox.sections = [{“map_to”:“text”,“name”:“text”,“type”:“textarea”,“height”:40},
{“map_to”:“description”,“name”:“description”,“type”:“textarea”,“height”:80},
{“map_to”:“location”,“name”:“location”,“type”:“textarea”,“height”:60},
{“map_to”:“color”,“name”:“color”,“type”:“select”,“height”:30, “options”:scheduler.serverList(“sl_1_635077644160137899”)},
{“map_to”:“time”,“name”:“time”,“type”:“calendar_time”,“height”:30}];
scheduler.__show_minical = function(){
if (scheduler.isCalendarVisible())
scheduler.destroyCalendar();
else
scheduler.renderCalendar({“navigation”:true,
“date”:scheduler._date,
“position”:“schedulerdhx_minical_icon”,
“handler”:function(date,calendar){
scheduler.setCurrentView(date);
scheduler.destroyCalendar()
}
});
}
scheduler.config.details_on_create = true;
scheduler.config.details_on_dblclick = true;
scheduler.config.prevent_cache = true;
scheduler.config.server_utc = true;
scheduler.config.time_step = 30;
scheduler.config.multi_day = true;
scheduler.config.separate_short_events = true;
scheduler.config.hour_date = ‘%g:%i%a’;
scheduler.config.default_date = ‘%M %j, %Y’;
scheduler.config.scroll_hour = 13;
scheduler.init(‘scheduler_here’,new Date(2013,5,25));
dp = scheduler.dataProcessor = new dataProcessor("/Calendar/Save");
dp.init(scheduler);
dp.setTransactionMode(“POST”, false);
scheduler.load("/Calendar/LoadData", “json”);
— Controller / Actions ------------------------------------------------------------------------------
public ContentResult LoadData()
{
var data = new SchedulerAjaxData();
var models = GetLoggedInAgentCalendarEvents();
data.Add(models);
return new ContentResult {Content = data.ToString()};
}
public ContentResult Save(int? id, FormCollection actionValues)
{
var action = new DataAction(actionValues);
// Do NHibernate repository CRUD work according to values
return new ContentResult {Content = new AjaxSaveResponse(action).ToString()};
}
----- Final Observations ------------------------------------------------------------
Maybe completely unrelated but it appears that SchedulerAjaxData utilized a JSON data contract regardless of what you set the Scheduler object data format too; likewise, the AjaxSaveReponse renders XML regardless of data format. Maybe something there? As a hack, I tried to render the AjaxSaveReponse XML output as the JSON equivalent but that seemed to do nothing for me. Either way - I am guessing that it is the ContentResult on the return Save that is not correct for this default JSON Scheduler instance.
Any help is more than appreciated! Thanks in advance!
-squids