From 7c3878d0f0802f7cbde439129aac07271e547161 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 4 Nov 2019 08:02:23 -0500 Subject: [PATCH] Dynamic option lists for select elements This should respond better to changes in the model. --- ext/afform/core/ang/afField/afField.js | 8 +++++--- ext/afform/core/ang/afField/widgets/Select.html | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ext/afform/core/ang/afField/afField.js b/ext/afform/core/ang/afField/afField.js index 6c70a98e70..bd30e103d8 100644 --- a/ext/afform/core/ang/afField/afField.js +++ b/ext/afform/core/ang/afField/afField.js @@ -17,9 +17,11 @@ $scope.getData = $scope.afFieldset.getData; $scope.getOptions = function() { - return _.transform($scope.defn.options, function(result, val, key) { - result.push({id: key, text: val}); - }, []); + return { + results: _.transform($scope.defn.options, function(result, val, key) { + result.push({id: key, text: val}); + }, []) + }; }; $el.addClass('af-field-type-' + _.kebabCase($scope.defn.input_type)); diff --git a/ext/afform/core/ang/afField/widgets/Select.html b/ext/afform/core/ang/afField/widgets/Select.html index e59b2c724e..01ae74fbe8 100644 --- a/ext/afform/core/ang/afField/widgets/Select.html +++ b/ext/afform/core/ang/afField/widgets/Select.html @@ -1 +1 @@ - + -- 2.25.1