From 486842239c71e7964f38a09aacda4970f2a82e1a Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 7 Feb 2012 10:58:14 -0800 Subject: Updated tools and PI to get/set materials by binding to appModel's materials property. This requires us to add FlatMaterial to the list of materials in the MaterialsLibrary. Signed-off-by: Nivesh Rajbhandari --- js/components/combobox.reel/combobox.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'js/components/combobox.reel') 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, { value: null }, + dataField: { + value: null + }, + + dataFunction: { + value: null + }, + _items: { value: [] }, @@ -122,7 +130,19 @@ exports.Combobox = Montage.create(Component, { { var current = items[i]; optionItem = document.createElement("option"); - optionItem.value = current; + if(this.dataFunction) + { + optionItem.value = this.dataFunction(current); + } + else if(this.dataField) + { + optionItem.value = current[this.dataField]; + } + else + { + optionItem.value = current; + } + if(this.labelFunction) { optionItem.innerText = this.labelFunction(current); -- cgit v1.2.3