Skip to content

Limit the number of appointments loaded into the Scheduler storage dynamically.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/asp-net-mvc-scheduler-fetch-appointment-event

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scheduler for ASP.NET MVC - How to implement the FetchAppointments delegate method

This example demonstrates how to implenent the FetchAppointmentsMethod delegate to dynamically limit the number of appointments loaded into the Scheduler storage. This approach can be useful when a scheduler contains a large amount of data, and only a small part of it needs to be loaded at one time.

Call Bind(FetchAppointmentsMethod) or Bind(FetchAppointmentsMethod, Object) method to bind the Scheduler component to an appointment data source modified dynamically. Use the FetchAppointmentsMethod delegate to limit the number of appointments loaded into the Scheduler storage. The Interval property specifies the visible time interval. You can use this argument to calculate a new time interval to query a data source for appointments. Fetched appointments are returned to the caller to populate the scheduler.

@Html.DevExpress().Scheduler(SchedulerSettingsHelper.CommonSchedulerSettings).Bind(Model.FetchAppointments, Model.Resources).GetHtml()
public static SchedulerDataObject DataObject {
    get {
        SchedulerDataObject sdo = new SchedulerDataObject();
        sdo.Appointments = GetAppointments();
        sdo.Resources = GetResources();
        sdo.FetchAppointments = FetchAppointmentsHelperMethod;
        return sdo;
    }
}
public static object FetchAppointmentsHelperMethod(FetchAppointmentsEventArgs args) {
    args.ForceReloadAppointments = true;
    SchedulingDataClassesDataContext db = new SchedulingDataClassesDataContext();
    return db.DBAppointments.Where(e => e.StartDate > args.Interval.Start && e.EndDate < args.Interval.End);
}

Files to Review

Documentation