Calendar not refreshing on demand in IE9

Hi,

I have a calendar working with mvc3 (razor), I’m using the week view and I have an action that filters the calendar events.
Also, I use my own custom modal windows.

The thing is, it’s working fine in Chrome, but in IE9, everytime I create an event the browser stops responding to javascript.

This is my action:

[code]public ActionResult FilterWeek(WeekMonthEventsViewModel model)
{
var Sched = new DHXScheduler(this);
var vista = Sched.Views[1];
Sched.Views.Clear();
Sched.Views.Add(vista);
Sched.Config.multi_day = false;
Sched.Config.drag_create = false;
if (model.ShowWorkHours)
{
Sched.Config.first_hour = 8;
Sched.Config.last_hour = 18;
}
Sched.XY.scroll_width = 18;
Sched.Config.cascade_event_display = true;
Sched.Config.mark_now = true;
Session[“CalendarModel”] = ParseWeekMonthModelToFilter(model);
Sched.LoadData = true;// allows loading data
Sched.Data.DataProcessor.UpdateFieldsAfterSave = true;
Sched.Calendars.AttachMiniCalendar(true);
Sched.InitialView = “week”;
Sched.Data.EnableDynamicLoading(SchedulerDataLoader.DynamicalLoadingMode.Month);
Sched.EnableDataprocessor = true;// enables DataProcessor in order to enable implementation CRUD operations

        String[] userLang = Request.UserLanguages;
        if (userLang[0].Contains("es-ES") || userLang[0].Contains("es-AR"))
            Sched.Localization.Set(SchedulerLocalization.Localizations.Spanish);
        else
            Sched.Localization.Set(SchedulerLocalization.Localizations.English);
        model.Sched = Sched;
        
        
        return PartialView("WeekScheduler", model.Sched);
    }[/code]

My Data action is like this:

[code]public ContentResult Data()
{
EventFilter model = new EventFilter();
if (Session[“CalendarModel”] != null)
model = (EventFilter)Session[“CalendarModel”];
else
{
model.UsersID = new List();
model.UsersID.Add(SessionContext.Current.UserID);
}
return new SchedulerAjaxData(DataDemand(model));
}

public List DataDemand(EventFilter model)
{
DateTime dateFrom;
DateTime dateTo;
IEventService matterService = ServiceHelper.GetService();
if (Request.QueryString[“from”] != null)
{
dateFrom = DateTime.ParseExact(this.Request.QueryString[“from”], “yyyy-MM-dd”, CultureInfo.InvariantCulture);
dateTo = DateTime.ParseExact(this.Request.QueryString[“to”], “yyyy-MM-dd”, CultureInfo.InvariantCulture);
model.SinceDate = dateFrom;
model.UntilDate = dateTo;
}

        List<ThomsonReuters.InfolexWeb.Common.Models.Event> eventos = matterService.GetEvents(model, fillCollections: false);
        List<EventItem> items = new List<EventItem>();

        foreach (ThomsonReuters.InfolexWeb.Common.Models.Event e in eventos)
        {
            var item = new EventItem() { ID = e.ID, text = e.Text, start_date = new DateTime(e.Date.Year, e.Date.Month, e.Date.Day, e.StartTime.Value.Hour, e.StartTime.Value.Minute, e.StartTime.Value.Second), end_date = new DateTime(e.Date.Year, e.Date.Month, e.Date.Day, e.EndTime.Value.Hour, e.EndTime.Value.Minute, e.EndTime.Value.Second) };
            items.Add(item);
        }

        return items;
    }

[/code]

In Chrome, I can reload the scheduler even after creating an event. But in IE, not only it freezes, the scheduler goes back to a previous version of itself (with deleted events and without the new events).

It seems like I’m doing it wrong. There are a couple of things that concern me…

  1. Why the “week” view has a from and to of 1 or 2 months?
  2. How can I update just the event I created or deleted, without refreshing the whole grid?
  3. Why IE freezes after an update, and why is it bringing old information (it’s not going back to the server)?
  4. Why does it work in Chrome? :stuck_out_tongue:

Thanks in advance,
Javier

Hello Javier,

  1. from-to timespan size is defined by DynamicalLoadingMode, so only options are day, month and year, regardless of of the active view
  2. I think you may call client side scheduler.load(“url?id=” + targetEventId, “json”) and render only this specific event. It should be updated in the scheduler
  3. have you checked where exactly it freezes, in what method?

Hi Aliaksandr, thanks for your reply:

IE was behaving strange because I didn’t have the PreventCache defined in the first load.

I managed to make it work, but I’m not sure is optimized yet.

I still have to only update the event I just updated or canceled. I’ll try your suggestion.

But…

  1. If I choose DynamicalLoadingMode in Month, I don’t understand why it sometimes loads more than one month. Is it possible in the near future to load week by week?
  2. Also, when I have an event that exceeds the visible hours (i. e. if I defined start time and end time) the event shows an incorrect start and end time. Can I change that info somehow so it won’t say the incorrect information?

Thank you so much for your help.
Javier

  1. Yes, we’ll add this option in the next update(we plan to release it in a few weeks)

  2. I think you can override event header template for this, i’ll try to give you a sample in a while
    As an other option, you may use “limit_time_select” config, then user won’t be able to to set event time outside the visible hours
    scheduler.Config.limit_time_select = true;

Here is the template,
with this version of the component it easier to redefine it on the client-side

<script> scheduler.templates.event_header = function (start, end, ev) { var actualEv = scheduler.getEvent(ev.id); if (!actualEv) actualEv = ev; return scheduler.templates.event_date(actualEv.start_date) + " - " + scheduler.templates.event_date(actualEv.end_date); } </script>
you may put this code right after scheduler.Render call

Hi Aliaksandr, how are you?

I have the same problem.

How can I update just the event I created or updated, without refreshing the whole grid?

I have the event information in a modal form.

I tried what you said: scheduler.load(“url?id=” + targetEventId, “json”). But it doesn’t work.

Thanks in advance.

Regards
Javier