mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-02-04 05:35:44 +00:00
Implement TodaySelect event in RadzenScheduler
This commit is contained in:
@@ -152,6 +152,24 @@ namespace Radzen.Blazor
|
||||
[Parameter]
|
||||
public EventCallback<SchedulerSlotSelectEventArgs> SlotSelect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A callback that will be invoked when the user clicks the Today button.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// <RadzenScheduler Data=@appointments TodaySelect=@OnTodaySelect>
|
||||
/// </RadzenScheduler>
|
||||
/// @code {
|
||||
/// void OnTodaySelect(SchedulerTodaySelectEventArgs args)
|
||||
/// {
|
||||
/// args.Today = DateTime.Today.AddDays(1);
|
||||
/// }
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
[Parameter]
|
||||
public EventCallback<SchedulerTodaySelectEventArgs> TodaySelect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A callback that will be invoked when the user clicks an appointment in the current view. Commonly used to edit existing appointments.
|
||||
/// </summary>
|
||||
@@ -422,7 +440,11 @@ namespace Radzen.Blazor
|
||||
|
||||
async Task OnToday()
|
||||
{
|
||||
CurrentDate = DateTime.Now.Date;
|
||||
var args = new SchedulerTodaySelectEventArgs { Today = DateTime.Now.Date };
|
||||
|
||||
await TodaySelect.InvokeAsync(args);
|
||||
|
||||
CurrentDate = args.Today;
|
||||
|
||||
await InvokeLoadData();
|
||||
}
|
||||
|
||||
16
Radzen.Blazor/SchedulerTodaySelectEventArgs.cs
Normal file
16
Radzen.Blazor/SchedulerTodaySelectEventArgs.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using Radzen.Blazor;
|
||||
|
||||
namespace Radzen
|
||||
{
|
||||
/// <summary>
|
||||
/// Supplies information about a <see cref="RadzenScheduler{TItem}.TodaySelect" /> event that is being raised.
|
||||
/// </summary>
|
||||
public class SchedulerTodaySelectEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Today's date. You can change this value to navigate to a different date.
|
||||
/// </summary>
|
||||
public DateTime Today { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user