Resource and grouping values missing
Hi, I'm using the
Blazor SfSchedule component (version 27.2.4) and trying to implement a two-level hierarchy of resources: machine groups as the parent level and machines as the child level, and most of the values from the resources are missing from the scheduler.
I’m retrieving data using an ODataV4 endpoint and setting the DataSource properties accordingly . In my case there are 21 machine group every one of them has at least one machine and 120 machine from which 77 are assigned to these machine groups.
I’ve verified in my code that all these groups and machines are fetched correctly from the OData service and assigned to the productionMachineGroups and productionMachines lists, however I can only see 6 group and their machines in the scheduler.
Here are my respective code snippets
<SfSchedule @ref="MachineSch" TValue="MachineScheduleDTO"
Width="100%"
Height="calc(100vh - 5.2rem)"
@bind-CurrentView="CurrentView" @bind-SelectedDate="@CurrentDate"
TimeFormat="HH:mm"
AllowMultiCellSelection="true"
AllowMultiRowSelection="true">
<ScheduleEvents TValue="MachineScheduleDTO"
OnCellClick="OnCellClick"
OnPopupOpen="@OnPopupOpen"
OnActionBegin="OnActionBegin"
OnActionFailure="OnActionFailure"
Created = "OnScheduleCreated"
OnPopupClose="OnPopupClose"></ScheduleEvents>
<ScheduleGroup Resources="@Resources"></ScheduleGroup>
<ScheduleViews>
<ScheduleView Option="View.TimelineDay" StartHour="06:30" EndHour="06:30">
<ScheduleViewTimeScale SlotCount="1" Interval="30"></ScheduleViewTimeScale>
</ScheduleView>
<ScheduleView Option="View.TimelineWeek" Interval="2" DisplayName="Two Week" StartHour="06:30" EndHour="06:30">
<ScheduleViewTimeScale SlotCount="1" Interval="510"></ScheduleViewTimeScale>
</ScheduleView>
</ScheduleViews>
<ScheduleResources>
<ScheduleResource TItem="ProductionMachineGroup" TValue="Guid"
Field="UUID"
Title="Groups"
Name="Groups"
DataSource="@productionMachineGroups"
TextField="Name" IdField="UUID">
</ScheduleResource>
<ScheduleResource TItem="ProductionMachine" TValue="Guid"
Field="ProductionMachineUUID"
Title="Machines"
Name="Machines"
DataSource="@productionMachines"
TextField="Name" IdField="UUID"
GroupIDField="ProductionMachineGroupUUID" Query="ProductionMachineQuery">
</ScheduleResource>
</ScheduleResources>
<!-- EventSettings, etc. -->
</SfSchedule>
Data Loading Code:
public string[] Resources { get; set; } = { "Groups", "Machines" };
public List<ProductionMachine> productionMachines { get; set; } = new List<ProductionMachine>();
public List<ProductionMachineGroup> productionMachineGroups { get; set; } = new List<ProductionMachineGroup>();
protected override async Task OnInitializedAsync()
{
await Task.WhenAll(GetResources(), GetScheduleTypes(), GetShifts(), GetSchedules());
StateHasChanged();
}
private async Task GetResources()
{
var groups = await ODataService.GetEntitiesAsync<ProductionMachineGroup>("ProductionMachineGroup", "ProductionMachines" ) ?? new();
var machines = await ODataService.GetEntitiesAsync<ProductionMachine>("ProductionMachine", "ProductionMachineGroups" ) ?? new();
foreach (var machine in machines)
{
var assignedGroup = machine.ProductionMachineGroups?.FirstOrDefault();
if (assignedGroup != null)
machine.ProductionMachineGroupUUID = assignedGroup.UUID;
}
productionMachines = machines;
productionMachineGroups = groups;
}
Is there a configuration step I might be missing or do I need to specify something else in the Scheduler to display all values? Thank you very much in advance!
Hi Szabolcs ,
Based on
the shared details and code snippet, we suspect that the issue is due to the
resource child-level resource Query field not returning the data
properly. Additionally, please ensure that the OdtaV4 service, GroupIDField,
and Owner ID are correctly mapped. Kindly check and let us know if the
issue persists. If you're still facing issues, please share the runnable code. This
will help us align our understanding with your expectations and provide you
with the best possible assistance.
Regards,
Ashok
Hi Ashok,
I have double checked the code and found that I had an issue in how I was mapping the keys for the resources. After solving that everything works as expected. Thank you very much for your support.
Regards,
Szabolcs
Hi Szabolcs,
We are glad to hear that our provided suggestions solved your issue. Get back to us if you need any further assistance.
Regards,
Swathi
- 3 Replies
- 3 Participants
-
SZ Szabolcs
- Dec 18, 2024 01:29 PM UTC
- Dec 20, 2024 09:28 AM UTC