I am unable to get the Scheduler grouping to work in Timeline view., and have many hours attempting to get it to work.
I've followed this demo pretty closely, and MANY different attempts at getting grouping to work.
https://demos.telerik.com/blazor-ui/scheduler/grouping
Is there some property I'm missing that "turns grouping on"? I temporarily added the orientation so I could switch between Horz/Vert.
I've got hours and hours into this. I wish by default if you're configuring a control for something "special" like this, that it would error out and tell you through an exception that you're "missing x or y " or the mapping of a field is invalid or something! In this case, I've got the grouping setup with mapped fields, etc. (If I have invalid fields I get a dictionary error), etc. But no grouping. and NO errors. Very, very frustrating.
My theory is that I'm missing one simple little thing that "turns grouping on", but I'm not seeing it.
Any help, or further questions on my configuration, please feel free to ask.
Thanks in advance,
Curt
Here is my Scheduler Setup below. I will be removing Week view, it's there just to try different things.
<TelerikScheduler Data="@Shifts" Height="100%" Width="100%"
@bind-View="@CurrView"
TitleField="@(nameof(ShiftCalendarBindingModel.ProductionLineName))"
DescriptionField="@(nameof(ShiftCalendarBindingModel.LineTypeName))"
StartField="@(nameof(ShiftCalendarBindingModel.Start))"
EndField="@(nameof(ShiftCalendarBindingModel.End))"
IsAllDayField="@(nameof(ShiftCalendarBindingModel.IsAllDayApt))"
IdField="@(nameof(ShiftCalendarBindingModel.Id))"
Date="@CurrentDate"
DateChanged="@SchedulerDateChangedHandler">
<SchedulerSettings>
<SchedulerGroupSettings Resources="@GroupingResources" Orientation="@GroupingOrientation"></SchedulerGroupSettings>
</SchedulerSettings>
<SchedulerResources>
<SchedulerResource Field="LineTypeId" TextField="LineTypeName" ValueField="Id" Data="@LineTypes"></SchedulerResource>"
</SchedulerResources>
<ItemTemplate>
@{
var appointment = context as ShiftCalendarBindingModel;
}
<div style="height: 100%; width:100%; background-color:@(new MarkupString(appointment.BackGroundColor))">
<p><strong>@appointment.ProductionLineName</strong> Shift: @appointment.ShiftNumber </p>
</div>
</ItemTemplate>
<SchedulerViews>
<SchedulerTimelineView StartTime="@DayStart" EndTime="@DayEnd"ColumnWidth="50" SlotDuration="60" NumberOfDays="1" />
<SchedulerWeekView StartTime="@DayStart" EndTime="@DayEnd" SlotDivisions="2" SlotDuration="60" />
</SchedulerViews>
</TelerikScheduler>
This is what I'm considering "Important" properties:
List<SchedulerGroupOrientation> GroupingOrientationOptions = new List<SchedulerGroupOrientation> { SchedulerGroupOrientation.Horizontal, SchedulerGroupOrientation.Vertical };
private Telerik.Blazor.Components.TelerikScheduler<ShiftCalendarBindingModel> SchedulerRef { get; set; }
List<string> GroupingResources = new List<string> { "LineTypeId" };
public List<LineTypeModel> LineTypes { get; set; } = new List<LineTypeModel>();
public class LineTypeModel
{
public int? Id { get; set; }
public string LineTypeName { get; set; }
}
A few properties from my scheduler model, showing the "LineTypeId":
public class ShiftCalendarBindingModel
{
public long Id { get; set; }
public int? LineTypeId { get; set; }
}
Hi Curt,
To group the Scheduler, you need to define just two tags for:
You have both tags and their configuration looks correct. So the problem should be in the data:
Here is a simple REPL example for you to compare. If you need further assistance, send a similar example for inspection.
To potentially help others with issues getting resources to show: The order you initialize/load your various lists appears to matter, and you should recreate your resource lists on any refresh.
I had the List<Resource> MyResource {get;set;} = new List<Resource> as a property. It seems that if I fill this list dynamically based upon the loaded data and not create a new List each time the data is loaded the resource "view" would not show. Or if I assign the bound "Data" to the scheduler control before I assign the Resource list the resource would not show.
So, load your resources, creating a new list each time that you assign to MyResource (in this example).
After you've loaded/assigned your resource objects THEN assign your data (don't assign data then the resource list). It seems the "fill ui" routine of the control will not "refresh" if you clear and reuse your resource list (say it's a dynamic list that's determined by the data of the scheduler), and it will not refresh if you assign the resource property after the Data (data bound to the scheduler) property is assigned. In other words, data load order and list reuse can matter.
Hey Curt
Thanks so much for taking the time to respond and to write down your findings! Saved me a bunch of time struggling to do the same thing! 😍
Cheers,
Paul