This commit is contained in:
2021-01-27 20:01:14 +00:00
parent c6cb6f2e45
commit 05877d0a3e
2 changed files with 30 additions and 28 deletions

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using AyaNova.Biz; using AyaNova.Biz;
namespace AyaNova.DataList namespace AyaNova.DataList
{ {
@@ -13,34 +12,35 @@ namespace AyaNova.DataList
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
//Default ListView // //Default ListView
dynamic dlistView = new JArray(); // dynamic dlistView = new JArray();
dynamic cm = new JObject(); // dynamic cm = new JObject();
cm.fld = "displayfilename"; // cm.fld = "displayfilename";
cm.sort = "+"; // cm.sort = "+";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "object"; // cm.fld = "object";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "size"; // cm.fld = "size";
cm.sort = "-"; // cm.sort = "-";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "notes"; // cm.fld = "notes";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "exists"; // cm.fld = "exists";
dlistView.Add(cm); // dlistView.Add(cm);
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); DefaultColumns = new List<string>() { "displayfilename", "object", "size", "notes", "exists" };
DefaultSortBy = new Dictionary<string, string>() { { "displayfilename", "+" }, { "size", "-" } };
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined (in this case User) table need to be specified completely //NOTE: Due to the join, all the sql id and name fields that can conflict with the joined (in this case User) table need to be specified completely
@@ -94,6 +94,6 @@ namespace AyaNova.DataList
} }
}//eoc }//eoc
}//eons }//eons

View File

@@ -18,7 +18,8 @@ namespace AyaNova.DataList
//well, not here exactly but add a new DATALIST class if it will be displayed as a list anywhere in the UI or reported on //well, not here exactly but add a new DATALIST class if it will be displayed as a list anywhere in the UI or reported on
public AyaDataList() public AyaDataList()
{ {
// DefaultColumns = new List<string>();
// DefaultSortBy = new Dictionary<string, string>();
} }
public string SQLFrom { get; set; } public string SQLFrom { get; set; }
@@ -36,11 +37,12 @@ namespace AyaNova.DataList
//set defaults if not provided in listOptions //set defaults if not provided in listOptions
public void SetListOptionDefaultsIfNecessary(DataListBase listOptions) public void SetListOptionDefaultsIfNecessary(DataListBase listOptions)
{ {
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 (listOptions is DataListTableOptions)
if (((DataListTableOptions)listOptions).Columns.Count == 0) {//if this doesn't work then just ditch this method in favor of local code, it's not really saving much
((DataListTableOptions)listOptions).Columns = DefaultColumns; if (((DataListTableOptions)listOptions).Columns.Count == 0)
((DataListTableOptions)listOptions).Columns = DefaultColumns;
} }
if (listOptions.SortBy.Count == 0) if (listOptions.SortBy.Count == 0)
listOptions.SortBy = DefaultSortBy; listOptions.SortBy = DefaultSortBy;
} }