Skip to content

Lack of button types in header of QuickGrid #45216

Closed
@oruchreis

Description

@oruchreis

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Hi
As you know, the default type of a button is submit when the type is not specified in the html. When we nest QuickGrid into a form, it submits the form after clicking a button in the header template. Because these buttons don't have the type attribute:

https://github.com/aspnet/AspLabs/blob/a7080f692f4c43f1ab5450460ec0746d35a298c4/src/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor#L109

It should has type attributes like this:

private void RenderDefaultHeaderContent(RenderTreeBuilder __builder)
    {
        @if (HeaderTemplate is not null)
        {
            @HeaderTemplate(this)
        }
        else
        {
            @if (ColumnOptions is not null && Align != Align.Right)
            {
                <button type="button" class="col-options-button" @onclick="@(() => Grid.ShowColumnOptions(this))"></button>
            }

            if (Sortable.HasValue ? Sortable.Value : IsSortableByDefault())
            {
                <button type="button" class="col-title" @onclick="@(() => Grid.SortByColumnAsync(this))">
                    <div class="col-title-text">@Title</div>
                    <div class="sort-indicator" aria-hidden="true"></div>
                </button>
            }
            else
            {
                <div class="col-title">
                    <div class="col-title-text">@Title</div>
                </div>
            }

            @if (ColumnOptions is not null && Align == Align.Right)
            {
                <button type="button" class="col-options-button" @onclick="@(() => Grid.ShowColumnOptions(this))"></button>
            }
        }
    }

Expected Behavior

The buttons in the default header template should have type attribute with value of button, so it doesn't submit the parent form.

Steps To Reproduce

Place QuickGrid into a form, then click filter button or column header button to sort.

Exceptions (if any)

No response

.NET Version

dotnet 7

Anything else?

No response

Activity

added
bugThis issue describes a behavior which is not expected - a bug.
on Nov 22, 2022
added this to the .NET 8 Planning milestone on Nov 22, 2022
ghost

ghost commented on Nov 22, 2022

@ghost

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

ghost locked as resolved and limited conversation to collaborators on Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-blazor-quickgrid

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @oruchreis@javiercn@mkArtakMSFT

      Issue actions

        Lack of button types in header of QuickGrid · Issue #45216 · dotnet/aspnetcore