Dynamic Loading Issues

Hi,

Issue #1:
Duplication of Events in Dynamic Loading:
I have enabled Dynamic loading in my calendar POC by using the following statements:

Initialization:
sched.Data.Loader.EnableDynamicLoading(SchedulerDataLoader.DynamicalLoadingMode.Month);

In data method:
public ContentResult Data(int calendarType)
{
var dateFrom = DateTime.ParseExact(this.Request.QueryString[“from”], “yyyy-MM-dd”, CultureInfo.InvariantCulture);
var dateTo = DateTime.ParseExact(this.Request.QueryString[“to”], “yyyy-MM-dd”, CultureInfo.InvariantCulture);
}
I am sending thses dates to my SQL query and filter the event data and loading the same

when I click on next month(navigation button), the data is reloading which leads to duplication of events on the calendar(as shown in attached snapshot). I thought this is caching issue and I tried prevent cache by using this statement(sched.Config.prevent_cache = true)
After this, scheduler(events) are not loading.

Could you please let me know how should we solve this issue.

Issue #2:

Loading of Recurring Event with Dynamic Loading:

I would like to know how about loading of recurring event in case if dynamic loading option is enabled in scheduler(calendar).

My assumptions are summarized below:

i have created an recurring event today as shown below:

Recurring Option: 1st Monday of the month and is for a year
Time: 21-May-201210:00 AM to 21-May-2012 11:00AM

In case of dynamic loading, the application will load data of every month dynamically. If i navigate to next month or 6 months(i.e. October 2012) from now, the application will send from and to date as query string and these will be used to fetch the data from SQL. If i do this, i will get the data of the October 2012 where as my recurring event start date and end date will be having may 2012. So this recurring event will not be loaded on the calendar.

Please review and let me know your thoughts.

Regards,
Kamal

Regards,
Kamal




Hello,
1)Does your event objects have an id property, when you pass it to SchedulerAjaxData? Recurring events may be loaded multiple times, but scheduler wouldn’t render event, if it already contains one with the same id

2)There should be no difference from loading of the single events. start_date and end_date of the recurring event stores time interval of the whole serie, not the particular record
e.g. this linq to sql query handles dynamic loading correctly

[code]public ActionResult Data()
{
var dateFrom = DateTime.ParseExact(this.Request.QueryString[“from”], “yyyy-MM-dd”, CultureInfo.InvariantCulture);
var dateTo = DateTime.ParseExact(this.Request.QueryString[“to”], “yyyy-MM-dd”, CultureInfo.InvariantCulture);

        return new SchedulerAjaxData( 
            from ev in new DHXSchedulerDataContext().Recurrings 
                where (ev.start_date < dateTo && ev.end_date > dateFrom) 
            select ev  
        );

}[/code]

Hi Aliaksandr,

Yes, I am using Id property. Please find my event entity file below.
public class Event
{
public virtual int Id { get; set; }
public virtual int CalendarTypeId { get; set; }
public virtual String Title { get; set ; }
Public virtual string Description { get; set; }
public virtual DateTime start_date { get; set; }
public virtual DateTime end_date { get; set; }
public virtual string location { get; set; }
}
I am filling this above entity by using N-hibernate and loading it to the calendar.
I am not sure, why the application is duplicating the events. As you know, I have mentioned two values in actionValues[“Id”] field in another ticket might be impact on this. The reason is, when I click on the next button in month view, the application triggers the data method and load the data. As you said, it will check the Id and will not match. So it is rendering again.

Please let me know, is my event entity structure is correct or do you have any other suggestions to avoid this.

Regards,
Kamal

Adding to it, the below is my data method:

public ContentResult Data(int calendarType, int calendarEventTypeId, int calendarCategoryTypeId)
{
ContentResult data = null;
agentCode = GetAgentCode();

        var dateFrom = DateTime.ParseExact(this.Request.QueryString["from"], "yyyy-MM-dd", CultureInfo.InvariantCulture);
        var dateTo = DateTime.ParseExact(this.Request.QueryString["to"], "yyyy-MM-dd", CultureInfo.InvariantCulture);

                            data = new SchedulerAjaxData(_eventServices.LoadCalendarEvents(calendarType, dateFrom, dateTo));        
       
        return data;
    }

Hi,

public class Event { public virtual int Id { get; set; }
try to use id( in lower case ) for the scheduler, client-side calendar is case sensitive. It must be a reason of the issue.
correct model will look like this:

public class Event { public virtual int id { get; set; }

Hi Aliaksandr,

Great! it is working fine after changes done as per your suggestion.

Thank you very much for your support.

Regards,
Kamal

Hi Aliaksandr,

Good Morning!

Thank very much for all your support and cooperation.

As you know, I have enabled dynamic loading(Monthly) in my calendar POC. It is working as expected but i have a noticed an issue in dynamic loading in Map tab. Please find details below.

I have created few normal events and a recurring event which occurs weekly on Monday with no end date. When I load the data, the application will send the start date and end date and brings the events matches with filter criteria. The data is loading properly on day, week and Month view. When I click on Map tab, it is not responding and getting the java script confirmation message after 1 or 2 minutes. When I kill this loading process then map tab is showing so many recurring.
I would like know how to limit the map tab events for a month or two even if it is recurring event. Could you suggest me the best approach to solve this issue.

Hello Kamal,
I was glad to help:)

you may limit events for map view by setting map_start and map_end configs. There is no server-side implementation for them, but anyway you would need to use them on client.
The following code will do the job, you may put it right after Render() call

<script> // updating dates to display on before view change scheduler.attachEvent("onBeforeViewChange", function (old_mode, old_date, new_mode, new_date) { scheduler.config.map_start = scheduler.date.month_start(new Date((new_date || old_date).valueOf())); scheduler.config.map_end = scheduler.date.add(scheduler.config.map_start, 1, "month"); return true; }); </script>
note that end date is defined by the next expression
scheduler.date.add(scheduler.config.map_start, 1, “month”)

  • we increasing start date by one month(instead of “month” there could be “day” or “year”)

Hi,

Thank you very much.

I implemented the same in my POC and is working fine.

Regards,
Kamal