on 06-14-2020 1:29 AM
I have insert form where end user can type in value and submit. I need to add drop down for couple of fields where user will have to select from drop down value.
As of now this is the code to add value but need a drop down to give option for YES or NO
function openCreateDialog(){
var oCreateDialog = new sap.ui.commons.Dialog();
oCreateDialog.setTitle("Insert New User Data");
var oSimpleForm = new sap.ui.layout.form.SimpleForm({
maxContainerCols: 2,
content:[
new sap.ui.core.Title({text:"Users"}),
new sap.ui.commons.Label({text:"Id"}),
new sap.ui.commons.TextField({value:""}),
new sap.ui.commons.Label({text:"FLAG"}),
//dropdown for the FLAG (YES / NO)
new sap.ui.commons.TextField({value:''})
]
});
I found how it works here normally but cannot emulate the same in my code
If it was a simple html file I could have used following code with some modification
<!DOCTYPE html>
<html>
<body>
<h1>Flag </h1>
<label for="flag"> Choose Flag</label>
<select id="flag">
<option value="YES">Yes</option>
<option value="NO">No</option>
</select>
</body>
</html>
Please guide / help me since I am using UI5 template theme="sap_belize", not able to translate aforesaid html code UI5 code..
Thanking in advance
Please use sap.m.ComboBox.
If you use xml view you can simply do this like:
<ComboBox>
<core:Item key="yes" text="yes" />
<core:Item key="no" text="no" />
</ComboBox>
If you want to define dynamically something like this should work-
new sap.m.ComboBox().addItem({key: 'yes',text:'yes'}).addItem({key:'no',text:'no'});
Let me know if this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.