aboutsummaryrefslogtreecommitdiff
path: root/js/components/combobox.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/combobox.reel')
-rw-r--r--js/components/combobox.reel/combobox.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js
index deef2a47..8906a649 100644
--- a/js/components/combobox.reel/combobox.js
+++ b/js/components/combobox.reel/combobox.js
@@ -27,6 +27,14 @@ exports.Combobox = Montage.create(Component, {
27 value: null 27 value: null
28 }, 28 },
29 29
30 dataField: {
31 value: null
32 },
33
34 dataFunction: {
35 value: null
36 },
37
30 _items: { 38 _items: {
31 value: [] 39 value: []
32 }, 40 },
@@ -122,7 +130,19 @@ exports.Combobox = Montage.create(Component, {
122 { 130 {
123 var current = items[i]; 131 var current = items[i];
124 optionItem = document.createElement("option"); 132 optionItem = document.createElement("option");
125 optionItem.value = current; 133 if(this.dataFunction)
134 {
135 optionItem.value = this.dataFunction(current);
136 }
137 else if(this.dataField)
138 {
139 optionItem.value = current[this.dataField];
140 }
141 else
142 {
143 optionItem.value = current;
144 }
145
126 if(this.labelFunction) 146 if(this.labelFunction)
127 { 147 {
128 optionItem.innerText = this.labelFunction(current); 148 optionItem.innerText = this.labelFunction(current);