From 70b84963102d84d1b156c1cfafb117e7dea2706a Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Fri, 4 Oct 2013 07:21:19 +0000 Subject: [PATCH] Handle more complicated select_options style options, including icons. --- etemplate/js/et2_widget_dropdown_button.js | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/etemplate/js/et2_widget_dropdown_button.js b/etemplate/js/et2_widget_dropdown_button.js index 5e4ac01bae..56f5c69ebe 100644 --- a/etemplate/js/et2_widget_dropdown_button.js +++ b/etemplate/js/et2_widget_dropdown_button.js @@ -329,10 +329,33 @@ var et2_dropdown_button = et2_inputWidget.extend( } else { - for(var key in options) + var add_complex = function(node, options) { - this.menu.first().append("
  • "+options[key]+"
  • "); + for(var key in options) + { + var item; + if(typeof options[key] == "string") + { + item = $j("
  • "+options[key]+"
  • "); + } + else if (options[key]["label"]) + { + item =$j("
  • "+options[key]["label"]+"
  • "); + } + // Optgroup + else + { + item = $j("
  • "+key+"
  • "); + add_complex(node.append("