Hi Nick,
Greetings from Syncfusion Support.
We checked your requirement “load the data for current week only” and we suspect that you were loading the data from database using the service. So we prepare the sample with OData service to load the data from database to filter the data only for the current view.
// GET: odata/EventDatas(5)
[EnableQuery]
[AcceptVerbs("GET")]
public IQueryable<EventData> GetEventDatas(string StartDate, string EndDate)
{
DateTime start = DateTime.Parse(StartDate);
DateTime end = DateTime.Parse(EndDate);
return db.EventDatas.Where(evt => evt.StartTime >= start && evt.EndTime <= end);
} |
Note: the params StartDate and EndDate are passed from source end by default.
Index.razor
<SfSchedule TValue="Restful_Crud.Models.EventData" Height="550px" SelectedDate="new DateTime(2018, 5, 10)">
<ScheduleEventSettings TValue="Restful_Crud.Models.EventData" Query="@QueryData">
<SfDataManager Url="http://localhost:25255/odata" Adaptor="Adaptors.ODataV4Adaptor"></SfDataManager>
</ScheduleEventSettings>
</SfSchedule>
@code{
public Query QueryData = new Query().From("EventDatas");
} |
For more reference, please check the below-attached sample.
Please check the above sample and get back to us if you need any further assistance.
Regards,
Vengatesh