Browse Source

Add `PropertyName` and use it as sort field.

pull/16172/head
maliming 3 years ago
parent
commit
4ec1dc6f13
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 8
      framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumn.cs
  2. 6
      framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs
  3. 2
      framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor

8
framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumn.cs

@ -10,14 +10,22 @@ public class TableColumn
{
public string Title { get; set; }
public string Data { get; set; }
public string PropertyName { get; set; }
[CanBeNull]
public string DisplayFormat { get; set; }
public IFormatProvider DisplayFormatProvider { get; set; } = CultureInfo.CurrentCulture;
[CanBeNull]
public Type Component { get; set; }
public List<EntityAction> Actions { get; set; }
[CanBeNull]
public Func<object, string> ValueConverter { get; set; }
public bool Sortable { get; set; }
public TableColumn()

6
framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs

@ -608,7 +608,8 @@ public abstract class AbpCrudPageBase<
yield return new TableColumn
{
Title = lookupPropertyDefinition.GetLocalizedDisplayName(StringLocalizerFactory),
Data = $"ExtraProperties[{propertyInfo.Name}]"
Data = $"ExtraProperties[{propertyInfo.Name}]",
PropertyName = propertyInfo.Name
};
}
else
@ -616,7 +617,8 @@ public abstract class AbpCrudPageBase<
var column = new TableColumn
{
Title = propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory),
Data = $"ExtraProperties[{propertyInfo.Name}]"
Data = $"ExtraProperties[{propertyInfo.Name}]",
PropertyName = propertyInfo.Name
};
if (propertyInfo.IsDate() || propertyInfo.IsDateTime())

2
framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor

@ -105,7 +105,7 @@
}
else
{
<DataGridColumn TItem="TItem" Field="@nameof(IHasExtraProperties.ExtraProperties)" Caption="@column.Title">
<DataGridColumn TItem="TItem" Field="@nameof(IHasExtraProperties.ExtraProperties)" SortField="@column.PropertyName" Caption="@column.Title">
<DisplayTemplate>
@{
var entity = context as IHasExtraProperties;

Loading…
Cancel
Save