ResourceScheduler - Initial Draft #1951
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi all
Further to Scheduler - Resource and/or grouping
this is a draft PR with my effort for implementing the above. It is a draft PR as I know there are at least a few items still to resolve, documentation comments, moving
css
out of razor files, complete testing, e.t.c., but I wanted to check that what I'm putting forward looks acceptable.Some notes on implementation
Changes to existing files
The majority of the logic still resides in the Scheduler component. I've tried to do this with minimal change to any existing files.
Reason for changes to existing files are as follows -
SchedulerViewBase.cs
Additional
CascadingParameter
required in order to attachResourceScheduler
to theView
in the same way it does withScheduler
.RadzenScheduler.razor.cs
Additional signature for
SelectView
so that anIndex
can be passed as opposed to anISchedulerView
object. This is because theResourceScheduler
accepts a collection ofViews
as theChildContent
in the same way asScheduler
does, but eachScheduler
component (TResource
column) will have it's ownViews
collection. The actual object wouldn't match, so we select by index instead.SchedulerSlotEventArgs.cs
Because we are calling from another component, we have to change the scope of the
IsDefaultPrevented
property tointernal
.Navigation methods (OnPrev, OnNext, Today and View selections)
The majority of what the
ResourceScheduler
does is act as a conduit for the existingScheduler
methods and events, but adding theResource
element to them.In the case of navigation methods, they all follow the same basic pattern -
iterating through the
Dictionary<TLink, RadzenScheduler<TItem>> Schedulers { get; set; } = new();
that is populated during the render process<RadzenScheduler @ref=@Schedulers[resourceId]
and actioning the appropriate existingScheduler
method.Event Handlers
These are basically extensions of the existing event handlers, but with the
TResource
added to theargs
. They are built in the following way using aDictionary
to hold the handler for eachScheduler
(example usingSlotSelect
event)-Some of the events have additional code to handle drag drop, in much the same way as the code from the
DataGrid
toScheduler
drag drop example.I think that covers most of the bones of the component. I'm sure the source will reveal anything I've missed.
Hope this is of interest
Regards
Paul