Closed Gena-developer closed 1 year ago
You can't add custom parameters to the event.
Can you give me an example of a parameter you want to pass? There is probably another way.
I need to put id_event anywhere for each calendar event, then open my event form with information from my database by id.
On Tue, May 30, 2023 at 7:48 AM Dan Heron @.***> wrote:
You can't add custom parameters to the event.
Can you give me an example of a parameter you want to pass? There is probably another way.
— Reply to this email directly, view it on GitHub https://github.com/danheron/Heron.MudCalendar/issues/25#issuecomment-1568376217, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3I5RI5WEHPPXXKIAUD3B5DXIXUB7ANCNFSM6AAAAAAYTFGG6E . You are receiving this because you authored the thread.Message ID: @.***>
The way to do it would be to create a custom CellTemplate that has an OnClick event.
ok, thanks, do you have any examples?
On Tue, May 30, 2023 at 8:27 AM Dan Heron @.***> wrote:
The way to do it would be to create a custom CellTemplate that has an OnClick event.
— Reply to this email directly, view it on GitHub https://github.com/danheron/Heron.MudCalendar/issues/25#issuecomment-1568436156, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3I5RI3OVIZ4YKTQ5C2L6UTXIXYTNANCNFSM6AAAAAAYTFGG6E . You are receiving this because you authored the thread.Message ID: @.***>
Here is an example
<MudCalendar Items="_events">
<CellTemplate>
<MudLink OnClick="() => EventClicked((CustomItem)context)">
<div class="mud-cal-cell-template">
<MudChip Label="true" Color="Color.Primary" Class="mud-cal-cell-template-chip">@context.Text</MudChip>
</div>;
</MudLink>
</CellTemplate>
</MudCalendar>
@code {
[Inject]
private IDialogService DialogService { get; set; }
private void EventClicked(CustomItem item)
{
DialogService.ShowMessageBox("Event Clicked", $"Id = {item.Id}");
}
private List<CustomItem> _events = new()
{
new CustomItem
{
Id = 16734,
Start = DateTime.Today.AddHours(10),
End = DateTime.Today.AddHours(11),
Text = "Event today"
},
new CustomItem
{
Id = 84528,
Start = DateTime.Today.AddDays(1).AddHours(11),
End = DateTime.Today.AddDays(1).AddHours(12.5),
Text = "Event tomorrow"
}
};
private class CustomItem : CalendarItem
{
public int Id { get; set; }
}
}
Thank you very much, I really like it.
Hi, I have a question, how can I send custom my parameters to CellClicked or maybe there is another way? for example CellClicked (DateTime dateTime, here my parameters)