This commit is contained in:
2020-01-15 21:55:45 +00:00
parent addafcb9a5
commit e1f92dfd5e
2 changed files with 14 additions and 11 deletions

View File

@@ -133,6 +133,14 @@ namespace AyaNova.Biz
}
//Standard mini COLUMN definition
public static string GenerateMINIListColumnJSON(AyaType defaultLinkType)
{
return $"[ {{\"cm\":\"_df_\",\"dt\":0,\"ay\":{(int)defaultLinkType}}},{{\"cm\":\"Widget\",\"dt\":{(int)AyaDataType.Text},\"ay\":{(int)defaultLinkType}}}]";
}
//Accept a json template
//return a column list suitable for api list return
public static string GenerateListColumnJSONFromTemplate(AyaType defaultLinkType, string ObjectKey, string template)
@@ -149,8 +157,8 @@ namespace AyaNova.Biz
sb.Append("[");
//_df_ First column is always the _df_ column
sb.Append($"{{\"cm\":\"_df_\",\"dt\":{(int)defaultLinkType}}}");
sb.Append($"{{\"cm\":\"_df_\",\"dt\":0,\"ay\":{(int)defaultLinkType}}}");
foreach (string s in fullFields)
{
ObjectField o = fields.FirstOrDefault(x => x.Key == s);

View File

@@ -326,19 +326,14 @@ namespace AyaNova.Biz
}
";
//TODO: BUILD THE COLUMNS RETURN PROPERTY JSON FRAGMENT
//for MINI format we just use a static column definition built in to this list object
//for FULL we build it from the template automatically
//BUILD THE COLUMNS RETURN PROPERTY JSON FRAGMENT
string ColumnsJSON = string.Empty;
if (listOptions.Mini)
{
//all mini lists will have an id so include the type to open
ColumnsJSON = $"[ {{\"cm\":\"_df_\",\"dt\":0,\"ay\":{(int)AyaType.Widget}}},{{\"cm\":\"Widget\",\"dt\":{(int)AyaDataType.Text},\"ay\":{(int)AyaType.Widget}}}]";
//"[{\"cm\":\"WidgetName\",\"dt\":4},{\"cm\":\"WidgetSerial\",\"dt\":5},{\"cm\":\"WidgetDollarAmount\",\"dt\":8},{\"cm\":\"WidgetRoles\",\"dt\":10},{\"cm\":\"WidgetStartDate\",\"dt\":1},{\"cm\":\"Active\",\"dt\":6}]"
{
ColumnsJSON = ObjectFields.GenerateMINIListColumnJSON(AyaType.Widget);
}
else
{
//TODO: need at least one column to be the openable object here or else nothing will open
{
ColumnsJSON = ObjectFields.GenerateListColumnJSONFromTemplate(AyaType.Widget, ObjectFields.WIDGET_KEY, MOCK_WIDGET_DISPLAY_TEMPLATE_JSON);
}