Activities of "skander"

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

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;
        }
    }
}
Showing 1 to 1 of 1 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11