This commit is contained in:
2021-01-29 22:03:48 +00:00
parent 3bc7aba2c2
commit bf55d43e37
4 changed files with 32 additions and 11 deletions

View File

@@ -32,7 +32,8 @@ namespace AyaNova.DataList
throw new System.UnauthorizedAccessException("User roles insufficient for this datalist"); throw new System.UnauthorizedAccessException("User roles insufficient for this datalist");
//turn the DataListTableRequest into a //turn the DataListTableRequest into a DataListTableProcesingOptions object here
DataListTableProcessingOptions dataListTableOptions = new DataListTableProcessingOptions(dataListTableRequest, DataList, ct);
DataList.SetListOptionDefaultsIfNecessary(dataListTableOptions); DataList.SetListOptionDefaultsIfNecessary(dataListTableOptions);
@@ -261,7 +262,7 @@ namespace AyaNova.DataList
// if (string.IsNullOrWhiteSpace(listView)) // if (string.IsNullOrWhiteSpace(listView))
// listView = DataList.DefaultListView; // listView = DataList.DefaultListView;
DataList.ProcessRequest(dataListSelectionOptions); DataList.SetListOptionDefaultsIfNecessary(dataListSelectionOptions);
// //parse the list view // //parse the list view
// var ListViewArray = JArray.Parse(listView); // var ListViewArray = JArray.Parse(listView);

View File

@@ -40,7 +40,7 @@ namespace AyaNova.DataList
public Dictionary<string, string> DefaultSortBy { get; set; } public Dictionary<string, string> DefaultSortBy { get; set; }
//set defaults if not provided in listOptions //set defaults if not provided in listOptions
public void ProcessRequest(Models.DataListProcessingBase listOptions) public void SetListOptionDefaultsIfNecessary(Models.DataListProcessingBase listOptions)
{ {
//columns, filter and sortby could all be null //columns, filter and sortby could all be null
if (listOptions.Filter == null) if (listOptions.Filter == null)

View File

@@ -23,7 +23,7 @@ namespace AyaNova.DataList
List<string> DefaultColumns { get; set; } List<string> DefaultColumns { get; set; }
Dictionary<string, string> DefaultSortBy { get; set; } Dictionary<string, string> DefaultSortBy { get; set; }
void ProcessRequest(Models.DataListProcessingBase listOptions); void SetListOptionDefaultsIfNecessary(Models.DataListProcessingBase listOptions);
Newtonsoft.Json.Linq.JArray GenerateReturnListColumns(List<string> columns); Newtonsoft.Json.Linq.JArray GenerateReturnListColumns(List<string> columns);
// List<string> GetFieldListFromListView(JArray listViewArray); // List<string> GetFieldListFromListView(JArray listViewArray);

View File

@@ -1,15 +1,35 @@
using System.Collections.Generic; using System.Collections.Generic;
using AyaNova.DataList;
namespace AyaNova.Models namespace AyaNova.Models
{ {
public sealed class DataListTableProcessingOptions : DataListProcessingBase internal sealed class DataListTableProcessingOptions : DataListProcessingBase
{ {
public List<string> Columns { get; set; } internal List<string> Columns { get; set; }
public const int MaxPageSize = 1000; internal const int MaxPageSize = 1000;
public const int DefaultOffset = 0; internal const int DefaultOffset = 0;
public const int DefaultLimit = 25; internal const int DefaultLimit = 25;
public int? Offset { get; set; } internal int? Offset { get; set; }
public int? Limit { get; set; } internal int? Limit { get; set; }
internal DataListTableProcessingOptions(
DataListTableRequest request,
IDataListProcessing dataList,
AyContext ct)
{
//set some values from request
Limit=request.Limit;
Offset=request.Offset;
base.ClientCriteria=request.ClientCriteria;
base.DataListKey=request.DataListKey;
//populate some values from saved filter and default columnview
//COLUMNS
}
} }
} }