dotnet-starter-kit icon indicating copy to clipboard operation
dotnet-starter-kit copied to clipboard

Custom column in EntityTable

Open OnlyOneBDS opened this issue 1 year ago • 4 comments

How can I add a custom column that will show button based on the status of the record. For example, let's say in one row, the status is "Eligible", the column - let's call it Actions 2 - will show a "Create Invoice" button that will send the user to the "Create Invoice" page. I hope that I explained this correctly

Thanks in advance! :)

OnlyOneBDS avatar Feb 20 '25 07:02 OnlyOneBDS

In the grid, or on the page?

Get Outlook for iOShttps://aka.ms/o0ukef


From: Edwidge Amisial @.> Sent: Thursday, February 20, 2025 9:44:14 AM To: fullstackhero/dotnet-starter-kit @.> Cc: Subscribed @.***> Subject: [fullstackhero/dotnet-starter-kit] Custom column in EntityTable (Issue #1097)

How can I add a custom column that will show button based on the status of the record. For example, let's say in one row, the status is "Eligible", the column - let's call it Actions 2 - will show a "Create Invoice" button that will send the user to the "Create Invoice" page. I hope that I explained this correctly

Thanks in advance! :)

— Reply to this email directly, view it on GitHubhttps://github.com/fullstackhero/dotnet-starter-kit/issues/1097, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXYXSF7ZBRBJYJABCRW5PNL2QWBU5AVCNFSM6AAAAABXQB2T3OVHI2DSMVQWIX3LMV43ASLTON2WKOZSHA3DKMZTHE4TIMA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

[OnlyOneBDS]OnlyOneBDS created an issue (fullstackhero/dotnet-starter-kit#1097)https://github.com/fullstackhero/dotnet-starter-kit/issues/1097

How can I add a custom column that will show button based on the status of the record. For example, let's say in one row, the status is "Eligible", the column - let's call it Actions 2 - will show a "Create Invoice" button that will send the user to the "Create Invoice" page. I hope that I explained this correctly

Thanks in advance! :)

— Reply to this email directly, view it on GitHubhttps://github.com/fullstackhero/dotnet-starter-kit/issues/1097, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXYXSF7ZBRBJYJABCRW5PNL2QWBU5AVCNFSM6AAAAABXQB2T3OVHI2DSMVQWIX3LMV43ASLTON2WKOZSHA3DKMZTHE4TIMA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

kallievz avatar Feb 20 '25 19:02 kallievz

The grid actually. I want to say that it may involve editing the EntityTable component but I'm not too sure about that.

OnlyOneBDS avatar Feb 21 '25 22:02 OnlyOneBDS

You can use template property for custom columns. For example you can look Audit.razor page. In this case, you can define custom template, for your special column.

Audit.razor.cs

fields: new()
{
    new(audit => audit.Id,"Id"),
     new(audit => audit.DateTime, "Date Time", Template: DateFieldTemplate),
   ...
},

Audit.razor

private RenderFragment<RelatedAuditTrail> DateFieldTemplate => trail => __builder =>
{
    <MudItem>
        <MudChip T=string Icon="@Icons.Material.Filled.Watch" IconColor="Color.Secondary" Label="true" Color="Color.Surface">@trail.DateTime.ToString("dd-MMMM-yyyy hh:mm tt")</MudChip>
    </MudItem>
    <MudItem>
        <MudChip T=string Icon="@Icons.Material.Filled.Watch" IconColor="Color.Secondary" Label="true" Color="Color.Surface">@trail.UTCTime.ToString("dd-MMMM-yyyy hh:mm tt") (UTC)</MudChip>
    </MudItem>
};

umutaktas avatar Mar 17 '25 14:03 umutaktas

Nice, this solved my problem!!!

OnlyOneBDS avatar May 16 '25 16:05 OnlyOneBDS