Skip to content

Commit

Permalink
fixes #407 [HxGrid] - grid with multiselect can select checkbox when …
Browse files Browse the repository at this point in the history
…no data are on grid
  • Loading branch information
hakenr committed Jan 8, 2024
1 parent f3e9b3a commit 4e25e6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Havit.Blazor.Components.Web.Bootstrap/Grids/HxGrid.razor
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@
var headerCellTemplate = column.GetHeaderCellTemplate(gridHeaderCellContext);
bool isSortingActive = (totalCount > 0) && columnSorting.Any();

<th @key="@column" role="@(isSortingActive ? "button" : null)"
<th @key="@column"
role="@(isSortingActive ? "button" : null)"
class="@CssClassHelper.Combine(headerCellTemplate.CssClass, isSortingActive ? (isCurrentSorting ? "hx-grid-sorted" : "hx-grid-sortable") : null)"
@onclick="@(isSortingActive ? async () => await HandleSortingClick(column) : null)"
@onclick:stopPropagation="isSortingActive">
@onclick="@(isSortingActive ? async () => await HandleSortingClick(column) : null)"
@onclick:stopPropagation="isSortingActive">
<div class="hx-grid-header-cell-container">
<div class="hx-grid-header-cell-template">@headerCellTemplate.Template</div>
@if (isSortingActive)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ protected override GridCellTemplate GetHeaderCellTemplate(GridHeaderCellContext
#endif
builder.AddEventStopPropagationAttribute(105, "onclick", true);

if ((context.TotalCount is null) || (context.TotalCount == 0))
{
builder.AddAttribute(102, "disabled");
}

builder.CloseElement(); // input
}
};
Expand Down

0 comments on commit 4e25e6e

Please sign in to comment.