gpt4 book ai didi

javascript - SAPUI5 分段按钮选择

转载 作者:行者123 更新时间:2023-11-28 03:23:42 25 4
gpt4 key购买 nike

我的应用程序中有两个分段按钮元素作为交付和收集,我想通过从前端将交付作为“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
}

最佳答案

您不应该为每个按钮单独使用按下事件,因为它是 Segmented Button 的聚合控件。在分段按钮控件中使用“选择”事件并获取所选按钮的键。请通过我编写代码的以下链接。

http://veui5infra.dhcp.wdf.sap.corp:8080/snippix/snippets/34075

关于javascript - SAPUI5 分段按钮选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45095471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com