CE-936 - Add support for managing associations on insert/edit screens, via childRecordList widget

This commit is contained in:
2024-03-18 12:28:23 -05:00
parent 753c224196
commit d1e4091eb4
3 changed files with 120 additions and 45 deletions

View File

@ -779,9 +779,30 @@ public class QJavalinImplementation
{
String fieldName = formParam.getKey();
List<String> values = formParam.getValue();
String value = values.get(0);
if("associations".equals(fieldName) && StringUtils.hasContent(value))
{
JSONObject associationsJSON = new JSONObject(value);
for(String key : associationsJSON.keySet())
{
JSONArray associatedRecords = associationsJSON.getJSONArray(key);
for(int i = 0; i < associatedRecords.length(); i++)
{
QRecord associatedRecord = new QRecord();
JSONObject recordJSON = associatedRecords.getJSONObject(i);
for(String k : recordJSON.keySet())
{
associatedRecord.withValue(k, ValueUtils.getValueAsString(recordJSON.get(k)));
}
record.withAssociatedRecord(key, associatedRecord);
}
}
continue;
}
if(CollectionUtils.nullSafeHasContents(values))
{
String value = values.get(0);
if(StringUtils.hasContent(value))
{
record.setValue(fieldName, value);