Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions PanoramicData.Blazor/PDTable.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@oncontextmenu:preventDefault
@ondrop="OnDragDropAsync"
@onkeydown="OnKeyDownAsync"
@onkeydown:stopPropagation>
@onkeydown:stopPropagation>
<table class="table @TableClass"
@onmousedown="OnTableMouseDown">
<thead>
Expand Down Expand Up @@ -59,7 +59,7 @@
<PDFilter FetchValuesAsync="@((f) => OnFetchFilterValuesAsync(column, f))"
Filter="column.Filter"
FilterChanged="OnFilterChanged"
Options="@column.FilterOptions"
Options="@column.FilterOptions"
ShowValues="@column.FilterShowSuggestedValues"
DataType="@column.GetFilterDataType()"
Nullable="@column.GetFilterIsNullable()" />
Expand Down Expand Up @@ -133,13 +133,30 @@
{
<PDClipboard CssClass="me-1" Text="@(column.GetRenderValue(item))" />
}
if (column.Template == null)

if (AllowRightClick)
{
@column.GetRenderValue(item)
<div @oncontextmenu:stopPropagation>
@if (column.Template == null)
{
@column.GetRenderValue(item)
}
else
{
@column.Template(item)
}
</div>
}
else
{
@column.Template(item)
if (column.Template == null)
{
@column.GetRenderValue(item)
}
else
{
@column.Template(item)
}
}
}
</td>
Expand Down
5 changes: 5 additions & 0 deletions PanoramicData.Blazor/PDTable.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@
/// </summary>
[Parameter] public bool AutoLoad { get; set; } = true;

/// <summary>
/// Determines whether items can be right-clicked to show a context menu or perform an action.
/// </summary>
[Parameter] public bool AllowRightClick { get; set; }

/// <summary>
/// Callback fired before an item edit begins.
/// </summary>
Expand Down Expand Up @@ -1474,7 +1479,7 @@

foreach (var key in Selection)
{
var item = ItemsToDisplay.Find(x => KeyField(x).ToString() == key);

Check warning on line 1482 in PanoramicData.Blazor/PDTable.razor.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Dereference of a possibly null reference.
if (item != null)
{
items.Add(item);
Expand Down
Loading