Skip to content

Lack of button types in header of QuickGrid #45216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
oruchreis opened this issue Nov 21, 2022 · 1 comment · Fixed by #48277
Closed
1 task done

Lack of button types in header of QuickGrid #45216

oruchreis opened this issue Nov 21, 2022 · 1 comment · Fixed by #48277
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-blazor-quickgrid
Milestone

Comments

@oruchreis
Copy link

oruchreis commented Nov 21, 2022

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

@javiercn javiercn added area-blazor Includes: Blazor, Razor Components feature-blazor-quickgrid labels Nov 22, 2022
@mkArtakMSFT mkArtakMSFT added the bug This issue describes a behavior which is not expected - a bug. label Nov 22, 2022
@mkArtakMSFT mkArtakMSFT added this to the .NET 8 Planning milestone Nov 22, 2022
@ghost
Copy link

ghost commented Nov 22, 2022

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-blazor-quickgrid
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@oruchreis @javiercn @mkArtakMSFT and others