-
Notifications
You must be signed in to change notification settings - Fork 898
Supply Appointment data to SchedulerSlotRenderEventArgs - #2050 #2154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi @paulo-rico, Thank you for the PR. My only concern is that AppointmentsInRange/Slot are being called multiple times for the same slot (once during layout and once in GetAttributesForSlot). In most cases the Appointments property in the SlotRenderEventArgs is not going to be used including all existing ones. It would still lead to overhead though. Two possible solutions come to mind:
private Func<IEnumerable<AppointmentData>> getAppointments;
private IEnumerable<AppointmentData> appointments;
public IEnumerable<AppointmentData> Appointments => appointments ?? = getAppointments(); |
Hi @akorchev Must say, I wasn't happy myself with calling the same function more than once per slot. Also, wasn't too sure about calling and storing the appointments. Just needed the nudge in the right direction regarding passing the function itself, so went with suggestion 2. |
/// <summary> | ||
/// List of appointments. | ||
/// </summary> | ||
public IEnumerable<AppointmentData> Appointments => appointments ?? (appointments = getAppointments()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use ??= here to make it shorter.
@@ -59,8 +59,8 @@ | |||
var excessCount = appointments.Count(); | |||
string classname = $"rz-slot-title {(day.Month != offSetMonth ? "rz-other-month" : "")} {(excessCount > 0 ? "rz-has-appointments" : "")} {(day == CurrentDate && month == CurrentMonth ? " rz-state-focused" : "")}".Trim(); | |||
|
|||
<div @onclick=@(args => OnListClick(day, appointments)) @attributes=@Attributes(day, "rz-slot")> | |||
<div class="@classname"> | |||
<div class="rz-slot" @onclick=@(args => OnListClick(day, appointments))> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks as a breaking change as it changes the location where Attributes are applied.
Hi @akorchev You're right. It is a breaking change. I'll move the I do think we need to be able to style the day as in It's calling out for it's own method - What do you think? Regards |
How about using the SlotRender event as in other views? Right now all events are set at RadzenScheduler level and introducing event for a view would be a discrepancy. |
I had used Below is an image where the It is still valid for a What do you think of having a |
DayNumberRender is misleading as it won't apply for every single day number but just for day view. Do we need this event at all? Shouldn't we just use AppointmentRender for this case too (days that have appointments)? |
It would be for Views I mentioned above -
I have already looked into this, but Looking at other libraries, maybe this is closer to what needs to be achieved. Using a |
The original idea of this PR was "Supply Appointment data to SchedulerSlotRenderEventArgs". Let's stick to that. |
Sorted (I think). |
As per request #2050, pass
AppointmentData
as a property inSchedulerSlotRenderEventArgs
class.Update demo site
Year
view to highlight this change.Regards
Paul