Hi
I have a problem with SfDataManager,
My code look like this
private IEnumerable<GrafikForm> Events;
<ScheduleEventSettings DataSource="@Events" TValue="GrafikForm" EnableTooltip="@TooltipEnable" Query="@LocalizationQuery">
<ChildContent>
<SfDataManager AdaptorInstance="@typeof(GrafikAdaptor)" Adaptor="Adaptors.CustomAdaptor">
</SfDataManager>
</ChildContent>
</
ScheduleEvents >
public void OnLocalizationChange(Syncfusion.Blazor.DropDowns.MultiSelectChangeEventArgs<int[]> args)
{
WhereFilter predicate;
if (args.Value != null && args.Value.Length > 0)
{
var filters = args.Value.Select(id => new WhereFilter
{
Field = "LocationId",
Operator = "equal",
value = id
});
// Łączymy filtry operatorem "lub" (Or).
predicate = filters.Aggregate((filter1, filter2) => filter1.Or(filter2));
this.LocalizationQuery = new Query().Where(predicate);
}
else
{
this.LocalizationQuery = new Query();
}
}
Problem is that :
Dear Customer,
Thank you for reaching out with your query. we understand you're trying to filter data in the SfDataManager using the LocationId.
To achieve this, you can pass the LocationId as an additional parameter, using the 'AddParams' method of the Query property of the Schedule, This will allow you to retrieve the provided LocationId in the data manager and filter the events based on it.
Here's an example of how you can implement this:
@using Syncfusion.Blazor.Schedule @using Syncfusion.Blazor.Data @using syncfusion_blazor_app.Data
<SfSchedule @ref="AvailabilityScheduleRef" TValue="AppointmentData" Width="100%" Height="600px" @bind-SelectedDate="@SelectedDate"> <ScheduleViews> <ScheduleView Option="View.Day"></ScheduleView> <ScheduleView Option="View.Week"></ScheduleView> <ScheduleView Option="View.WorkWeek"></ScheduleView> <ScheduleView Option="View.Month"></ScheduleView> <ScheduleView Option="View.Agenda"></ScheduleView> </ScheduleViews> <ScheduleEventSettings TValue="AppointmentData" Query="@QueryData"> <SfDataManager AdaptorInstance="@typeof(AppointmentDataAdaptor)" Adaptor="Adaptors.CustomAdaptor"> </SfDataManager> </ScheduleEventSettings> </SfSchedule>
@code { SfSchedule<AppointmentData>? AvailabilityScheduleRef; DateTime SelectedDate { get; set; } = new DateTime(2022, 5, 17); public static string _locationId = "1"; public Query QueryData = new Query().From("AppointmentDataDB-bc").AddParams("LocationId", _locationId); } |
In this code, the AddParams method is used to add the LocationId as a parameter to the query. This parameter can then be accessed in the data manager to filter the events.
For your convenience we have created a sample, Kindly check on the attached sample.
I hope this helps. If you have any further questions or need additional assistance, please don't hesitate to ask.
Regards,
Ram
Hi,
I looked at your project, and even in it that doesnt work
Regards
Hi Bartek,
In the ReadAsync method, you can retrieve the query parameters. With these parameters, you can perform the filtering operation. In your case you can get the location Id
In this code, You can retrieve the LocationId from the query parameters. Then, you can filter the EventData based on this LocationId.
Please refer to the attached image for reference.
We hope this helps. If you have any further questions or need additional assistance, please don't hesitate to ask.
Regards,
Ram