public function onBeforeRender() { parent::onBeforeRender(); $this->initList(); $template = OW::getPluginManager()->getPlugin("base")->getMobileCmpViewDir() . "button_list.html"; $this->setTemplate($template); }
public function onBeforeRender() { parent::onBeforeRender(); $this->initList(); $js = UTIL_JsGenerator::newInstance(); $js->jQueryEvent("#" . $this->uniqId . " .ca-dropdown-btn", "click", 'var dd = $(this).parents(".ca-dropdown-wrap:eq(0)").find(".ca-dropdown"); isVisible = dd.is(":visible"); ' . '$(".ca-dropdown:visible").hide(); ' . 'return isVisible ? (dd.hide(), true) : (dd.show(), false);'); $js->addScript('$(document).on("click", function(e) { return $(e.target).is(".ca-dropdown, .ca-dropdown *") ? false : $(".ca-dropdown:visible").hide(), true; });'); OW::getDocument()->addOnloadScript($js); }