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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user