Browse Source
Merge pull request #16172 from abpframework/AbpExtensibleDataGrid
Add `PropertyName` and use it as sort field.
pull/16189/head
liangshiwei
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
14 additions and
4 deletions
-
framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumn.cs
-
framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs
-
framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor
|
|
|
@ -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() |
|
|
|
|
|
|
|
@ -309,7 +309,7 @@ public abstract class AbpCrudPageBase< |
|
|
|
{ |
|
|
|
CurrentSorting = e.Columns |
|
|
|
.Where(c => c.SortDirection != SortDirection.Default) |
|
|
|
.Select(c => c.Field + (c.SortDirection == SortDirection.Descending ? " DESC" : "")) |
|
|
|
.Select(c => c.SortField + (c.SortDirection == SortDirection.Descending ? " DESC" : "")) |
|
|
|
.JoinAsString(","); |
|
|
|
CurrentPage = e.Page; |
|
|
|
|
|
|
|
@ -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()) |
|
|
|
|
|
|
|
@ -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; |
|
|
|
|