diff --git a/server/AyaNova/DataList/DataListFetcher.cs b/server/AyaNova/DataList/DataListFetcher.cs index d8127c06..497e5ad9 100644 --- a/server/AyaNova/DataList/DataListFetcher.cs +++ b/server/AyaNova/DataList/DataListFetcher.cs @@ -17,18 +17,18 @@ namespace AyaNova.DataList // Get the data list data requested // // - internal static async Task GetResponseAsync(AyContext ct, DataListTableProcessingOptions dataListTableProcessingOptions,IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId) + internal static async Task GetResponseAsync(AyContext ct, DataListTableProcessingOptions dataListTableProcessingOptions, IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId) { - // var DataList = DataListFactory.GetAyaDataList(dataListTableRequest.DataListKey); + // var DataList = DataListFactory.GetAyaDataList(dataListTableRequest.DataListKey); //was the name not found as a list? // if (DataList == null) // throw new System.ArgumentOutOfRangeException($"DataList \"{dataListTableRequest.DataListKey}\" specified does not exist"); - //turn the DataListTableRequest into a DataListTableProcesingOptions object here + //turn the DataListTableRequest into a DataListTableProcesingOptions object here //hydrates filter and column selections etc - // = new DataListTableProcessingOptions(dataListTableRequest, DataList, ct); + // = new DataListTableProcessingOptions(dataListTableRequest, DataList, ct); //#### TODO: below block into above method to clean it up and centralize it @@ -44,7 +44,7 @@ namespace AyaNova.DataList //Get the combination of all unique fields from both StaticServerFilterOptions and listOptions //NOTE: this assumes no list options filter colums that don't exist in listoptions.columns - // var AllUniqueFieldKeysRequiredForQuery = dataListTableOptions.Columns.Union(StaticServerFilterOptions.Select(z => z.Column).ToList()).ToList(); + // var AllUniqueFieldKeysRequiredForQuery = dataListTableOptions.Columns.Union(StaticServerFilterOptions.Select(z => z.Column).ToList()).ToList(); // //Add the internal filters into the listoptions existing filters // //NOTE: There is currently no overlap between internal filtered columns and filters coming from the client @@ -228,7 +228,7 @@ namespace AyaNova.DataList //BUILD THE COLUMNS RETURN PROPERTY JSON FRAGMENT Newtonsoft.Json.Linq.JArray ColumnsJSON = null; ColumnsJSON = DataList.GenerateReturnListColumns(dataListTableProcessingOptions.Columns); - return new DataListReturnData(rows, totalRecordCount, ColumnsJSON); + return new DataListReturnData(rows, totalRecordCount, ColumnsJSON, dataListTableProcessingOptions.SortBy, dataListTableProcessingOptions.Filter); } @@ -236,7 +236,7 @@ namespace AyaNova.DataList // Get a list of id's of the datalist results for reporting // // - internal static async Task GetIdListResponseAsync(AyContext ct, DataListSelectedProcessingOptions dataListSelectionOptions,IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId) + internal static async Task GetIdListResponseAsync(AyContext ct, DataListSelectedProcessingOptions dataListSelectionOptions, IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId) { // // var DataList = DataListFactory.GetAyaDataList(dataListSelectionOptions.DataListKey); // // //was the name not found as a list? diff --git a/server/AyaNova/DataList/DataListReturnData.cs b/server/AyaNova/DataList/DataListReturnData.cs index b3df9477..5d281dc5 100644 --- a/server/AyaNova/DataList/DataListReturnData.cs +++ b/server/AyaNova/DataList/DataListReturnData.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; +using AyaNova.Models; namespace AyaNova.DataList { @@ -6,13 +8,17 @@ namespace AyaNova.DataList public object Data { get; } public long TotalRecordCount { get; } - public object Columns {get;} + public object Columns { get; } + public Dictionary SortBy { get; set; } + public List Filter { get; set; } - public DataListReturnData(object returnItems, long totalRecordCount, Newtonsoft.Json.Linq.JArray columns) + public DataListReturnData(object returnItems, long totalRecordCount, Newtonsoft.Json.Linq.JArray columns, Dictionary sortBy, List filter) { Data = returnItems; TotalRecordCount = totalRecordCount; Columns = columns; + SortBy = sortBy; + Filter = filter; } }//eoc