Hi maliming
I saw that doc already, but I don't see any mention about AbpExtensibleDataGrid. I went to read some source code of yours and I found that a way to achieve that was to use Data and PropertyName at the same time.
But right now, I have another issue with the sorting, whenever I want to sort this ExtraProperty, it says:
No property or field 'Addresss' exists in type 'IdentityUser'
So I assume the AbpExtensibleDataGrid uses backend to sort and since Address is indeed not a column in my entity, it fails.
Do you have any clue how can I still sort but frontend only and avoid to sort backend for any "ExtraProperty" ?
My custom code has change since because I tried other ways but here's basically what it looks like:
Blazor.cs
[ExposeServices(typeof(UserManagement))]
[Dependency(ReplaceServices = true)]
public partial class MyUserManagement
{
[Inject]
public required IUserProfileAppService UserProfileAppService { get; set; }
protected override ValueTask SetTableColumnsAsync()
{
UserManagementTableColumns.AddRange(
[
new TableColumn
{
Title = L["Email"],
Data = "Email",
Sortable = true
},
// Here I consume and try to sort the extra property
new TableColumn
{
Title = "Address",
Data = "ExtraProperties[Address]",
PropertyName = "Addresss",
Sortable = true // <== this won't work!
},
]);
UserManagementTableColumns.AddRange(GetExtensionTableColumns("Identity", "User"));
return ValueTask.CompletedTask;
}
protected override async Task GetEntitiesAsync()
{
await base.GetEntitiesAsync();
await ExtendedEntities();
}
private async Task ExtendedEntities()
{
// I act directly on the IdentityUserDto, because the extra properties come from another db table
var userIds = Entities.Select(x => x.Id).ToList();
var userProfiles = await UserProfileAppService.GetListUserProfilesAsync(userIds);
var userProfilesDict = userProfiles.ToDictionary(x => x.InternalUserId, x => x);
foreach (var identityUserDto in Entities)
{
var profile = userProfilesDict.GetOrDefault(identityUserDto.Id);
if (profile is null)
{
continue;
}
// Here I add the extra property
identityUserDto.ExtraProperties["Address"] = profile.Address;
}
}
}
Hello, I'm overriding the page UserManagement
and I would like to add new columns to the table such as Address, City etc. to the IdentityUser
I thought I can use the property ExtraProperties
to add my custom properties but then I'm not sure how can I access my custom keys in TableColumn Data property?
This is what I have so far but it didn't work for me:
Error:
System.ArgumentException: Cannot detect the member of Volo.Abp.Data.ExtraPropertyDictionary (Parameter 'Address')
at Blazorise.DataGrid.Utils.FunctionCompiler.GetSafePropertyOrField(Expression item, String propertyOrFieldName)
at Blazorise.DataGrid.Utils.FunctionCompiler.GetSafePropertyOrField(Expression item, String propertyOrFieldName)
at Blazorise.DataGrid.Utils.FunctionCompiler.CreateValueGetter[IdentityUserDto](String fieldName)
at Blazorise.DataGrid.DataGridColumn`1[[Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Pro.Application.Contracts, Version=8.0.3.0, Culture=neutral, PublicKeyToken=null]].<.ctor>b__10_2()
Adding extra properties by overriding the function GetEntitiesAsync
Is there something I'm doing wrong? I'm open for suggestions or other ways to achieve that
Note that my address, city etc. live in another table right now called UserProfile.
Thanks
Hi, I'm in the current process of changing the current user language in mobile MAUI app using my own template. Though when I run my HttpAPI Host locally it works, but not when Host runs on an external server ? I'm not sure why. 🤔
Context: we have a desktop app (Blazor WebAssembly + basic theme) and a mobile app (Blazor MAUI + LeptonXTheme) that use the same UI to change language.
When I change language on desktop, it works using localStorage technique but on mobile app, it's a different code that execute to change language since localStorage isn't available.
I used LeptonXTheme ILanguagePlatformManager
to change language using ChangeAsync
method
This works perfectly when my server (HttpAPI Host) runs locally, but when I changed the address to point to an external server hosted on azurewebsites, it stopped working like if it cannot hit Abp/Languages/Switch
endpoint there?
I'm not quite sure why it behaves this way, do you have any idea that can guide me ?