MudBlazor / MudBlazor

Blazor Component Library based on Material design with an emphasis on ease of use. Mainly written in C# with Javascript kept to a bare minimum it empowers .NET developers to easily debug it if needed.
http://mudblazor.com
MIT License
7.21k stars 1.18k forks source link

TemplateColumn not rendering when EditMode is Cell #8817

Open w3ori opened 2 weeks ago

w3ori commented 2 weeks ago

Bug type

Component

Component name

TemplateColumn

What happened?

I've had trouble finding out why a TemplateColumn doesn't render when using EditMode=DataGridEditMode.Cell. Here is an example

    <MudDataGrid @ref="@_dataGrid"
                 T="EffectParameter"
                 Items="@Effect.EffectParameters"
                 EditMode="@DataGridEditMode.Cell"
                 CanceledEditingItem="@OnCanceledEditingItemAsync"
                 CommittedItemChanges="@OnCommittedItemChangesAsync"
                 Bordered="true"
                 ReadOnly="false"
                 Dense="true"
                 EditTrigger="@DataGridEditTrigger.OnRowClick">
        <Columns>
            <TemplateColumn CellClass="d-flex justify-end">
                <CellTemplate>
                    <MudStack Row="true">
                        <MudIconButton Class="pa-2" Size="@Size.Small" Icon="@Icons.Material.Outlined.Cancel" />
                        <MudIconButton Class="pa-2" Size="@Size.Small" Icon="@Icons.Material.Outlined.Edit" />
                        <MudIconButton Class="pa-2" Size="@Size.Small" Icon="@Icons.Material.Outlined.Remove" />
                    </MudStack>
                </CellTemplate>
            </TemplateColumn>
        </Columns>
    </MudDataGrid>

But it does not render the HTML output as follows. image

Why does the TemplateColoumn disappear when using the EditMode is Cell? How could I mitigate this, is there a workaround?

Issue from: https://github.com/MudBlazor/MudBlazor/discussions/6568

Expected behavior

Render template column

Reproduction link

https://try.mudblazor.com/snippet/wEmHaAECnUKNlthp

Reproduction steps

Add TemplateColumn when EditMode is Cell.

Relevant log output

No response

Version (bug)

6.19.1

Version (working)

No response

What browsers are you seeing the problem on?

Firefox, Chrome, Edge

On which operating systems are you experiencing the issue?

Windows

Pull Request

Code of Conduct

ScarletKuro commented 2 weeks ago

Hi.

I'm not datagrid expert, but as far as I know this is by design since Cell mode is an edit mode, therefore the CellTemplate is not used in this mode. @tjscience But if you want to show something in this mode, then instead of the CellTemplate you need to use EditTemplate. https://try.mudblazor.com/snippet/wOceEoQUKjCSNIrW