How to filter appointments in local data source?
I am following the example here: https://blazor.syncfusion.com/demos/scheduler/local-data?theme=bootstrap4&_ga=2.62695212.1040023476.1596096442-249026001.1576666961,
However I load the Appointment Data from a database, and I only want to return the appointments for the current week. Is there a way to only load the data for the current week? And load new data when the week is changed?
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
VM
Vengatesh Maniraj
Syncfusion Team
August 3, 2020 06:03 AM UTC
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.
Sample: https://www.syncfusion.com/downloads/support/forum/156522/ze/BlazorOData136588263-1610097086
Please check the above sample and get back to us if you need any further assistance.
Regards,
Vengatesh
Marked as answer
NI
Nick
August 4, 2020 08:22 AM UTC
Thank you, sorry I should have mentioned that I am using Blazor Server, not WebAssembly. Is there a solution for this?
AK
Alagumeena Kalaiselvan
Syncfusion Team
August 5, 2020 03:18 PM UTC
Hi Nik,
Thanks for your update
We have checked the shared sample which is created using Blazor server App. So, could you please ensure once with our shared sample and get back to us.
Regards
Alagumeena.K
SIGN IN To post a reply.