This commit is contained in:
@@ -42,14 +42,33 @@ namespace AyaNova.DataList
|
||||
//set defaults if not provided in listOptions
|
||||
public void SetListOptionDefaultsIfNecessary(DataListBase listOptions)
|
||||
{
|
||||
//columns, filter and sortby could all be null
|
||||
if (listOptions.Filter == null)
|
||||
listOptions.Filter = new List<DataListFilterOption>();
|
||||
|
||||
if (listOptions.SortBy == null)
|
||||
listOptions.SortBy = new Dictionary<string, string>();
|
||||
|
||||
//Check Columns
|
||||
if (listOptions is DataListTableOptions)
|
||||
{//if this doesn't work then just ditch this method in favor of local code, it's not really saving much
|
||||
if (((DataListTableOptions)listOptions).Columns.Count == 0)
|
||||
((DataListTableOptions)listOptions).Columns = DefaultColumns;
|
||||
{
|
||||
var dlto = ((DataListTableOptions)listOptions);
|
||||
if (dlto.Columns == null)
|
||||
dlto.Columns = new List<string>();
|
||||
//if this doesn't work then just ditch this method in favor of local code, it's not really saving much
|
||||
if (dlto.Columns.Count == 0)
|
||||
dlto.Columns = DefaultColumns;
|
||||
}
|
||||
|
||||
//Check SortBy
|
||||
if (listOptions.SortBy.Count == 0)
|
||||
listOptions.SortBy = DefaultSortBy;
|
||||
|
||||
//Check filter
|
||||
if (listOptions.Filter == null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace AyaNova.DataList
|
||||
|
||||
|
||||
//STATIC filter options from server
|
||||
List<DataListFilterOption> StaticServerFilterOptions = null;
|
||||
List<DataListFilterOption> StaticServerFilterOptions = new List<DataListFilterOption>();
|
||||
if (DataList is IAyaDataListServerCriteria)
|
||||
StaticServerFilterOptions = ((IAyaDataListServerCriteria)DataList).DataListServerCriteria(userId, userRoles, dataListTableOptions);
|
||||
|
||||
|
||||
@@ -9,6 +9,12 @@ namespace AyaNova.Models
|
||||
public Dictionary<string, string> SortBy { get; set; }
|
||||
public List<DataListFilterOption> Filter { get; set; }
|
||||
public string ClientCriteria { get; set; }
|
||||
|
||||
public DataListBase()
|
||||
{
|
||||
SortBy = new Dictionary<string, string>();
|
||||
Filter = new List<DataListFilterOption>();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user