<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="false">
<xp:this.script><![CDATA[
XSP.openMenu(thisEvent,#{javascript:getComponent('popupMenu1').getMenuCtor()});
]]></xp:this.script>
</xp:eventHandler>
</xp:button>
<xe:popupMenu id="popupMenu1">
<xe:this.treeNodes>
<xe:basicLeafNode label="menu item 1" submitValue="mi1">
<xe:this.onClick><![CDATA[document.getElementById("#{id:mi1Event}").click();]]></xe:this.onClick>
</xe:basicLeafNode>
<xe:basicLeafNode label="menu item 2" submitValue="mi2">
<xe:this.onClick><![CDATA[document.getElementById("#{id:mi2Event}").click();]]></xe:this.onClick>
</xe:basicLeafNode>
</xe:this.treeNodes>
<xp:eventHandler event="onItemClick" submit="true" refreshMode="complete">
<xe:this.action>
<![CDATA[#{javascript:
print("onItemClick event running"); // Will not run!
}]]></xe:this.action>
</xp:eventHandler>
</xe:popupMenu>
<xp:button value="_mi1" id="mi1Event" style="display:none;">
<xp:eventHandler event="onclick" submit="true" refreshMode="partial" immediate="false" onComplete="console.log('onComplete of mi1 running');" refreshId="popupMenu1">
<xp:this.action><![CDATA[#{javascript:print("ssjs code for mi1 running");}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="_mi2" id="mi2Event" style="display:none;">
<xp:eventHandler event="onclick" submit="true" refreshMode="partial" immediate="false" onComplete="alert('onComplete of mi2 running');" refreshId="popupMenu1">
<xp:this.action><![CDATA[#{javascript:print("ssjs code for mi2 running");}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:view>
输出必须在订单中。从运营,医疗,分析和运营开始技术。
输出:
var arr = [{Analytics:26}, {Technology:22}, {Medical:40}, {Operations:90}]
答案 0 :(得分:1)
您可以将对象与
合并var merged = Object.assign({}, ...arr);
然后选择你想要的那些:
var output = [merged.Operations, merged.Medical, merged.Analytics, merged.Technology];
如果你更喜欢纯粹的下划线:
var merged = _.extend({}, ...arr);
_.map(['Operations', 'Medical', 'Analytics', 'Technology'], prop => merged[prop]);