From 457de23ffc4356907677b23a72c6e2aa27b970a8 Mon Sep 17 00:00:00 2001 From: Johan Kool <94987086+JohanKool3@users.noreply.github.com> Date: Tue, 17 Jun 2025 11:53:15 +0100 Subject: [PATCH] BC-61, Added AllowRightClick option to allow users to right click table items --- PanoramicData.Blazor/PDTable.razor | 27 ++++++++++++++++++++++----- PanoramicData.Blazor/PDTable.razor.cs | 5 +++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/PanoramicData.Blazor/PDTable.razor b/PanoramicData.Blazor/PDTable.razor index b10929bcd..6b5f3cc80 100644 --- a/PanoramicData.Blazor/PDTable.razor +++ b/PanoramicData.Blazor/PDTable.razor @@ -10,7 +10,7 @@ @oncontextmenu:preventDefault @ondrop="OnDragDropAsync" @onkeydown="OnKeyDownAsync" - @onkeydown:stopPropagation> + @onkeydown:stopPropagation> @@ -59,7 +59,7 @@ @@ -133,13 +133,30 @@ { } - if (column.Template == null) + + if (AllowRightClick) { - @column.GetRenderValue(item) +
+ @if (column.Template == null) + { + @column.GetRenderValue(item) + } + else + { + @column.Template(item) + } +
} else { - @column.Template(item) + if (column.Template == null) + { + @column.GetRenderValue(item) + } + else + { + @column.Template(item) + } } } diff --git a/PanoramicData.Blazor/PDTable.razor.cs b/PanoramicData.Blazor/PDTable.razor.cs index 598e94e78..ef976774d 100644 --- a/PanoramicData.Blazor/PDTable.razor.cs +++ b/PanoramicData.Blazor/PDTable.razor.cs @@ -73,6 +73,11 @@ public partial class PDTable : /// [Parameter] public bool AutoLoad { get; set; } = true; + /// + /// Determines whether items can be right-clicked to show a context menu or perform an action. + /// + [Parameter] public bool AllowRightClick { get; set; } + /// /// Callback fired before an item edit begins. ///