OracleJet Splitbutton 获取 select 事件值

OracleJet Splitbutton get select event value

使用 Oraclejet 框架,我试图制作一个只有 2 个选项的拆分按钮。我怎样才能区分它们以便每个人都有自己的功能?或者如何粘贴选中的文本作为参数?

是这样的

<div id="dialogWrapper" style="position:relative; max-height:1%; max-width:1%;">
 <button id="printPdf" style="margin-right:6px;"data-bind="
                        ojComponent: {component: 'ojButton',            
                                      menu:'#choices'
                                      }"/>

里面的菜单:

 <ul id="choices" style="display:none"
      data-bind="ojComponent: {component: 'ojMenu', select: print//here both of them call to same function}">
 <li id="PDF">
         a href="#"><span class=""></span>PDF</a>
        </li>
        <li id="Excel">
        <a href="#"><span class=""></span>Excel</a>
     </li>     
  </ul> 
 </div> 

这是通过使用选择处理函数的一些参数完成的:

我重新创建了上面的示例并测试了这段代码:

<div id="dialogWrapper" style="position:relative; max-height:1%; max-width:1%;">
 <button id="printPdf" style="margin-right:6px;"data-bind="
                        ojComponent: {component: 'ojButton',            
                                      menu:'#printOptionsList',
                                      label: 'Print Option'
                                      }"/>
 <ul id="printOptionsList" style="display:none"
      data-bind="ojComponent: {component: 'ojMenu', select:printOptionHandler}">
 <li id="selPdf"><a href="#"><span class="oj-menu-item"></span>PDF</a></li>
 <li id="selExcel"><a href="#"><span class="oj-menu-item"></span>Excel</a>
     </li>     
  </ul> 
 </div> 

至于脚本部分,我已经将 printOptionHandler 添加到主敲除对象中:

self.printOptionHandler = function(event,ui){
            var sel = ui.item.children("a").text();
            //alert('option selected: ' + sel);
            if (sel == "Excel") {
                alert("calling Excel function");
            } else if (sel == "PDF"){
                alert ("calling PDF function");
            }
        };

这是否也会在您这边呈现所需的输出?