namespace CloudGaming.Shared.Models.PagingViews;
///
/// 列头信息
///
public class TableColumnView
{
public TableColumnView()
{
}
public TableColumnView(string fieldName, string title)
{
FieldName = fieldName;
Title = title;
Show = !fieldName.StartsWith("_");
}
public TableColumnView(string fieldName, string title, int width)
{
FieldName = fieldName;
Title = title;
Show = !fieldName.StartsWith("_");
Width = width.ToString();
}
public TableColumnView(string fieldName, string title, bool show, int width)
{
FieldName = fieldName;
Title = title;
Show = show;
Width = width.ToString();
}
///
/// 字段名称
///
[JsonProperty("dataIndex")]
public string FieldName { get; set; }
///
/// 标题名称
///
public string Title { get; set; }
///
/// 是否显示
///
public bool Show { get; set; } = true;
///
/// 列宽度
///
public string Width { get; set; } = string.Empty;
///
/// 是否参加排序
///
public bool Sorter { get; set; } = true;
///
/// 映射字段
///
/// 列显示名称
/// 是否显示列
/// 列宽
/// 是否参加排序
public void SetColumn(string title = null, bool? show = null, string width = null, bool sort = true)
{
if (!string.IsNullOrWhiteSpace(title)) Title = title;
if (show != null) Show = show.Value;
if (!string.IsNullOrWhiteSpace(width)) Width = width;
Sorter = sort;
}
}