on 04-09-2019 7:52 PM
I am trying to get data from sap.m.Select but it is always undefined and I am not sure what the issue is.
this.tierTemplate = new sap.ui.core.Item("tierLevel", {key: "{Level}" ,text: "{Level}"});
var tierOption = new sap.m.Select("tierOption", {
enabled: true,
items: {
path: "/level",
template: this.tierTemplate
},
width: "200px"
});
onPressSave: function(){
//var tier = sap.ui.getCore().byId("tierLevel").getSelectedItem();
var tier = this.getView().byId("tierLevel").getSelectedKey().getTex();
console.log(tier);
},
you have defined a template upon which the items in the sap.m.select are to be populated.
you have assigned the id "tierleve"l to template.
when you say byID(tierlevel) you are fetching the sap.ui.core.item object. but selectedKey method is defined for sap.m.select and not for sap.ui.core.item.
so fetch the object for sap.m.select and then use getselectedkey.
Kind Regards,
Vamsi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks guy. I got it working with you-all's help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your select is tierOption and you are trying to read from tierLevel if I'm not mistaken.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
10 | |
8 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.