This commit is contained in:
@@ -144,40 +144,9 @@ namespace AyaNova.Biz
|
||||
//convert to strings (https://stackoverflow.com/a/33836599/8939)
|
||||
var fullFields = ((JArray)jtemplate["full"]).ToObject<string[]>();
|
||||
|
||||
|
||||
// var jsonObj = new {
|
||||
// name = taskName,
|
||||
// products = new[] {
|
||||
// new { product = "ndvi_image", actions = new [] { new { mapbox = "processed" } },
|
||||
// new { product = "true_color", actions = new [] { new { mapbox = "processed" } }
|
||||
// },
|
||||
// recurring = true,
|
||||
// query = new {
|
||||
// date_from = dateFromString,
|
||||
// date_to = dateToString,
|
||||
// aoi = polygon
|
||||
// },
|
||||
// aoi_coverage_percentage = 90
|
||||
// };
|
||||
|
||||
// var jsonString = JsonConvert.SerializeObject(jsonObj);
|
||||
|
||||
|
||||
|
||||
//Generate JSON fragment to return with column definitions
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
// ColumnsJSON=@"""columns"":[ {""cm"":""Widget"",""dt"":""text"",""ay"":"+ AyaType.Widget.ToString()+ "},{..etc..}]";
|
||||
|
||||
//GOAL: This works in javascript:
|
||||
//JSON.parse( "{\"columns\": [{\"cm\":\"WidgetName\",\"dt\":\"4\"},{\"cm\":\"WidgetSerial\",\"dt\":\"5\"},{\"cm\":\"WidgetDollarAmount\",\"dt\":\"8\"},{\"cm\":\"WidgetRoles\",\"dt\":\"10\"},{\"cm\":\"WidgetStartDate\",\"dt\":\"1\"},{\"cm\":\"Active\",\"dt\":\"6\"}]}")
|
||||
//\"columns\": [{\"cm\":\"WidgetName\",\"dt\":\"4\"},{\"cm\":\"WidgetSerial\",\"dt\":\"5\"},{\"cm\":\"WidgetDollarAmount\",\"dt\":\"8\"},{\"cm\":\"WidgetRoles\",\"dt\":\"10\"},{\"cm\":\"WidgetStartDate\",\"dt\":\"1\"},{\"cm\":\"Active\",\"dt\":\"6\"}]
|
||||
|
||||
//CURRENTLY: this is what is actually coming out:
|
||||
// "columns": "[{\"cm\":\"WidgetName\",\"dt\":\"4\"},{\"cm\":\"WidgetSerial\",\"dt\":\"5\"},{\"cm\":\"WidgetDollarAmount\",\"dt\":\"8\"},{\"cm\":\"WidgetRoles\",\"dt\":\"10\"},{\"cm\":\"WidgetStartDate\",\"dt\":\"1\"},{\"cm\":\"Active\",\"dt\":\"6\"}]"
|
||||
|
||||
|
||||
|
||||
sb.Append("[");
|
||||
var isFirstColumn = true;
|
||||
foreach (string s in fullFields)
|
||||
@@ -193,7 +162,7 @@ namespace AyaNova.Biz
|
||||
//Build required part of column definition
|
||||
sb.Append($"\"cm\":\"{o.Key}\",\"dt\":{(int)o.DataType}");
|
||||
|
||||
//Has a AyObjectType (linkable / openable?)
|
||||
//Has a AyObjectType? (linkable / openable)
|
||||
if (o.AyObjectType != 0)
|
||||
sb.Append($",\"ay\":{(int)o.AyObjectType}");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user