[英]SAPUI5 Segmented Button Selection
我的应用程序中有两个分段按钮项,分别是“交付”和“收集”,我想通过从前端传递“ D”标志和“ C”标志来区分两个按钮,以了解单击了哪个按钮(两个按钮包含一组用于输入数据的字段)。 由于我是Custom SAUI5应用程序的新手,所以我不知道如何单独进行传递。 专家请帮帮我。 下面是我的代码,
<SegmentedButton selectedKey="small" id="idSegment">
<items>
<SegmentedButtonItem id="idSegDel" text="Delivery" key="delKey" press="handleDelivery" />
<SegmentedButtonItem id="idSegColl" text="Collection" key="colKey" press="handleCollection" enabled="true" />
</items>
</SegmentedButton>
handleCollection: function() {
this.byId("idPanelDimension").setVisible(true);
this.byId("idPanelDimension1").setVisible(true);
},
handleDelivery: function() {
this.byId("idPanelDimension").setVisible(false);
this.byId("idPanelDimension1").setVisible(false);
this.byId("idWeight").setValue("");
this.byId("idLength").setValue("");
this.byId("idBreadth").setValue("");
this.byId("idHeight").setValue("");
},
OnCreate : function(){
var oflagSeg = "D"; //this is only for D Flag but i need to set for both as if Delivery D is clicked or Collection C cliked.
var oEntry = {Flag: oflagSeg,} //Passing odata attribute
}
您不应为每个按钮单独使用press event,因为它是“分段按钮”的聚合控件。 在分段按钮控件中使用“选择”事件,并获取所选按钮的键。 请通过下面的链接我写代码。
HTTP://veui5infra.dhcp.wdf.sap.corp:8080 / snippix /段/ 34075
谢谢你的想法,我已经做到了,并且运行良好,下面是我的代码。
var oflagSeg = "";
var mainseg = sap.ui.getCore().byId("idRetDel1--idSegment").getSelectedKey();
if(mainseg == "keyDel"){
oflagSeg = "D";
}else if(mainseg == "keyCol"){
oflagSeg = "C";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.