Using the Oraclejet framework, I was trying to make a splitbutton which has only 2 options. How can I differentiate them so that each go to their own function? Or how can I paste the text of selected to function as parameter?
It was something like this
<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'
}"/>
The menu inside:
<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>
This is done by using some parameters of the selection handler function:
I've recreated the example above and tested this code:
as for the script part, I've added the printOptionHandler to the main knockout object:
Does this render the desired output on your side as well?