This commit is contained in:
2020-02-26 20:09:10 +00:00
parent 16d36c2b9c
commit 30abbfe0c2

View File

@@ -39,7 +39,7 @@ namespace AyaNova.DataList
return ret; return ret;
} }
public Newtonsoft.Json.Linq.JArray GenerateListColumnsJSONFromListView(JArray listViewArray) public Newtonsoft.Json.Linq.JArray GenerateListColumnsJSONFromListView(JArray listViewArray)
{ {
@@ -50,7 +50,8 @@ namespace AyaNova.DataList
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append("["); sb.Append("[");
bool FirstColumnAdded = false;
foreach (string s in ListViewFieldKeys) foreach (string s in ListViewFieldKeys)
{ {
@@ -66,7 +67,8 @@ namespace AyaNova.DataList
if (o != null) if (o != null)
{//Here is where we can vet the field name, if it doesn't exist. For production we'll just ignore those ones {//Here is where we can vet the field name, if it doesn't exist. For production we'll just ignore those ones
sb.Append(","); if (!FirstColumnAdded)
sb.Append(",");
sb.Append("{"); sb.Append("{");
//Build required part of column definition //Build required part of column definition
sb.Append($"\"cm\":\"{o.LtKey}\",\"dt\":{(int)o.UiFieldDataType}"); sb.Append($"\"cm\":\"{o.LtKey}\",\"dt\":{(int)o.UiFieldDataType}");
@@ -74,10 +76,11 @@ namespace AyaNova.DataList
//Has a AyObjectType? (linkable / openable) //Has a AyObjectType? (linkable / openable)
if (o.AyaObjectType != 0) if (o.AyaObjectType != 0)
sb.Append($",\"ay\":{(int)o.AyaObjectType}"); sb.Append($",\"ay\":{(int)o.AyaObjectType}");
//Row ID column? //Row ID column?
if(o.IsRowId){ if (o.IsRowId)
sb.Append($",\"rid\":1"); {
sb.Append($",\"rid\":1");
} }
//Has a Enumtype? //Has a Enumtype?
@@ -85,6 +88,7 @@ namespace AyaNova.DataList
sb.Append($",\"et\":\"{AyaNova.Util.StringUtil.TrimTypeName(o.EnumType)}\""); sb.Append($",\"et\":\"{AyaNova.Util.StringUtil.TrimTypeName(o.EnumType)}\"");
sb.Append("}"); sb.Append("}");
FirstColumnAdded = true;
} }
} }