I figured out how to add it from extended file. I missed that I needed a new class that inherits from my entity's base class. What really confused me was in the documentation it provides this article. But this article was the key article as it provided the key info about creating a new class. Based on that articles breadcrumb, I'm not sure it's linked up correctly. I found it by searching and it really helped.
For anyone else, I'm not sure we can disable toolbar buttons. But once you override and wait for SetToolbarItemsAsync, you can then clear and add back the buttons you need.
protected override async ValueTask SetToolbarItemsAsync()
{
Toolbar.Contributors.Clear();
Toolbar.AddButton("Import users from excel", () =>
{
//TODO: Write your custom code
return Task.CompletedTask;
}, "file-import", Blazorise.Color.Secondary);
}
<br>
Thanks for the suggestions. Is there a way to add my toolbar buttons in the extended.razor.cs so it doesn't get overwritten if we use ABP Suite to make changes later?
On question #2, I'm not trying to change the order but the visibility. Is there a way to hide or disable the default Create button?
Thanks,
John
What's the best way to set the value of a navigational property so the create and edit always have that value. Here's an example. I have a Dealership entity and a Leads entity. Leads has a required navigational property of DealershipId. Here's what I have working.
On the Dealerships razor page, I added and EntityAction.
<EntityAction TItem="DealershipDto" Visible="@CanEditDealership" Clicked="async () => await NavigateToLeads(context)" Text="@L["Leads"]"></EntityAction>
In Dealerships.Extended.razor.cs I added
private Task NavigateToLeads(DealershipDto dealership) { NavigationManager.NavigateTo($"/leads?DealershipId={dealership.Id}"); return Task.CompletedTask; }
Then in LeadsAppService.Extended.cs, I have
public async Task\<PagedResultDto> GetListByDealershipAsync(Guid dealershipId, PagedAndSortedResultRequestDto input)
{ var filterInput = new GetLeadsInput { DealershipId = dealershipId, Sorting = input.Sorting, MaxResultCount = input.MaxResultCount, SkipCount = input.SkipCount };
return await GetListAsync(filterInput);
}
This works and gives me a new button to add a lead filtered on the selected dealership.
I tried following the guide in this article but all I could get to work was add buttons not removing or editing.
#1: Is this the best way to do this or is there an obvious "ABP way" that I'm missing?
#2 If it is the best way, how do I disable/hide the default create button (New Lead below)?
#3 On create and edit, how do I hide/disable the Dealership selector as we don't want any chance of it being changed before saving.
The answer to #1 may make questions 2 and 3 moot. Thanks for any help.
John
Thanks.
If you Save and Generate a property with a default value, the value will be set on new entries as long as Required isn't checked. If Required is checked, the default value isn't populated when creating a new record. If you uncheck Required and Save and Generate, Default Value will again be set when creating a new record.
That's what I needed. My bad, I was looking all over and missed what was right in front of me. Thanks.
Yes, created by ABP Modules using ABP Suite. Specifically, we have a SQL column storing XML templates with variables in it that get populated when requested by an API. So, we need to be able to edit those templates (text areas) but they are so large we don't want to display them on the data grid. In this quick example, we don't want to show the column 'full description' in the attached image.
Instead, when we edit, then we would want Full Description to be a separate Tab on that form to be edited but not on the datagrid.
How do we hide columns? We have a few properties that are text areas with a lot of text. They blow up the datagrid so we want to hide them and only display them on separate Tabs when editing. With a Layered Application, what's the right way to set the visibility of those columns to hidden and then add those properties to their own tab when editing?
ABP Framework version: 0.9.22 UI Type: Blazor Server Database System: EF Core (SQL Server) Tiered (for MVC) or Auth Server Separated (for Angular)**: no Exception message and full stack trace: n/a Steps to reproduce the issue: n/a