Grid: AllowDetailView and AllowRowClick Conflict when enabled together
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
先从 Grid 组件对行点击和详情视图事件的处理入手,然后追踪点击展开按钮后如何到达 OnRowClick。启用两个选项来复现此行为,并确认展开按钮仍会打开详情视图,同时不会调用行点击回调。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
In the Grid component, setting both AllowDetailView and AllowRowClick to true causes both behaviors to be triggered when a row is clicked, resulting in unexpected behavior.
To Reproduce
- Add a Grid component.
- Set AllowRowClick="true" and OnRowClick="SomeFunction".
- Set AllowDetailView="true".
- Build and run the application, then click the Grid’s expand button.
- The row expands, and the OnRowClick behavior is triggered at the same time.
Expected behavior
When both AllowDetailView and AllowRowClick are enabled, clicking the expand button on the left should not trigger OnRowClick.
Alternatively, if this is the expected behavior, an exception should be thrown when both options are enabled.
Using OnRowDoubleClick works around the issue, but it doesn’t provide a good user experience.
Versions:
- .NET Version: .NET 10
- BlazorBootstrap: 4.0.0
- Blazor WebAssembly / Server: Server
- Blazor Interactive Render Mode: Server
- Blazor Interactivity Location: Global
Sample code
@page "/Test"
@attribute [StreamRendering]
<Grid TItem="string" Class="table table-bordered" DataProvider="GridDataProviderAsync" OnRowClick="OnRowClick" AllowRowClick="true" AllowDetailView="true">
<GridColumn TItem="string" HeaderText="Text" PropertyName="text" SortKeySelector="item => item">
@context
</GridColumn>
<GridDetailView TItem="string">
<Grid TItem="string" Class="table table-bordered" Data="@(new[] { context })">
<GridColumn TItem="string" Context="text" HeaderText="Head" PropertyName="Head">
@text.Substring(0, 1)
</GridColumn>
<GridColumn TItem="string" Context="text" HeaderText="Tail" PropertyName="Tail">
@text.Substring(text.Length - 1, 1)
</GridColumn>
<GridColumn TItem="string" Context="text" HeaderText="Length" PropertyName="Length">
@text.Length
</GridColumn>
</Grid>
</GridDetailView>
</Grid>
@code
{
[Inject]
public required NavigationManager NavManager { get; set; }
private async Task<GridDataProviderResult<string>> GridDataProviderAsync(GridDataProviderRequest<string> request)
{
var random = new Random();
var data = Enumerable.Range(0, 100).Select(_ => new string(Enumerable.Range(0, 8).Select(__ => (char)random.Next('A', 'Z' + 1)).ToArray())).ToList();
return request.ApplyTo(data);
}
private void OnRowClick(GridRowEventArgs<string> args)
{
var uri = $"https://google.com/search?q={args.Item}";
NavManager.NavigateTo(uri);
}
}
Desktop:
- OS: Windows 11
- Browser: Edge
- Version: 157
- 主要语言
- HTML
- 星标
- 1.2k
- 派生
- 111
- 平均合并
- 4 分钟
- 30 天内合并 PR
- 55
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
vikramlearning/blazorbootstrap 的其他 Issue
-
NET 11 Support未关闭
难度 3/5 1-2 天 新手友好度 28/100
vikramlearning/blazorbootstrap#1362 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
vikramlearning/blazorbootstrap#1346 ·
维护者通常 1 天内回复
-
Showcase: rich sample websites built with Blazor Bootstrap可能已有人在做 @gvreddy04 于 8 天前认领。 未关闭
vikramlearning/blazorbootstrap#1343 · 已指派 1 人 ·
维护者通常 1 天内回复
-
area-tree-view new component
难度 5/5 一周以上 新手友好度 8/100
vikramlearning/blazorbootstrap#1339 ·
维护者通常 1 天内回复
-
area-autocomplete area-forms area-multi-select new component
难度 5/5 一周以上 新手友好度 12/100
vikramlearning/blazorbootstrap#1338 ·
维护者通常 1 天内回复
查看 vikramlearning/blazorbootstrap 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
DioxusLabs/blitz#1614 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
boxlite-ai/boxlite#2777 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
quality-assurance
难度 2/5 1-3 小时 新手友好度 65/100
Paul-Austin-Oswego-CSC480-HCI521/gift-app#249 ·
维护者通常 1 天内回复
-
bug P3
难度 1/5 1 小时以内 新手友好度 87/100
维护者通常 1 天内回复