Grid: AllowDetailView and AllowRowClick Conflict when enabled together

Abierto Apto para principiantes
#1,388 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp
Área
frontend

Línea de trabajo

Empieza por la gestión de los clics en las filas y los eventos de la vista de detalle del componente Grid; después, sigue cómo los clics en el botón de expansión llegan a OnRowClick. Reproduce el comportamiento con ambas opciones habilitadas y confirma que el botón de expansión sigue abriendo la vista de detalle sin invocar el callback de clic en la fila.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

  1. Add a Grid component.
  2. Set AllowRowClick="true" and OnRowClick="SomeFunction".
  3. Set AllowDetailView="true".
  4. Build and run the application, then click the Grid’s expand button.
  5. 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
Lenguaje dominante
HTML
Estrellas
1.2k
Forks
111
Merge medio
4 min
PR fusionados (30 d)
55

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vikramlearning/blazorbootstrap

Todos los issues de vikramlearning/blazorbootstrap

Issues similares

Más issues de Web Dev

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.