on 08-05-2019 12:57 PM
Hello,
how can I insert a combobox in this XML? I want to bind it later on to a JSONModel:
<f:Form xmlns:sap.ui.layout.form="sap.ui.layout.form" editable="true" class="editableForm" id="__form01">
<f:layout>
<f:ResponsiveGridLayout labelSpanL="1" labelSpanM="1" labelSpanS="1" emptySpanL="1" emptySpanM="0" emptySpanS="0" columnsL="0" columnsM="1"/>
</f:layout>
<f:formContainers>
<sap.ui.layout.form:FormContainer id="container1">
<sap.ui.layout.form:formElements>
<sap.ui.layout.form:FormElement id="element1">
<sap.ui.layout.form:fields>
<Input id="inputFauf" liveChange="onScanFauf" editable="true" placeholder="{i18n>FERTA}" enabled="true"/>
</sap.ui.layout.form:fields>
<!--<sap.ui.layout.form:label>
<Label text="{i18n>Typ}" id="label1"/>
</sap.ui.layout.form:label>-->
</sap.ui.layout.form:FormElement>
<sap.ui.layout.form:FormElement id="element2">
<sap.ui.layout.form:fields>
<Input id="inputBund" liveChange="onScanBundnr" editable="true" placeholder="{i18n>HUNR}" value="{Bundnr}" enabled="true"/>
</sap.ui.layout.form:fields>
<!-- <sap.ui.layout.form:label>
<Label text="{i18n>Matnr}" id="label2"/>
</sap.ui.layout.form:label>-->
</sap.ui.layout.form:FormElement>
<sap.ui.layout.form:FormElement id="element3">
<sap.ui.layout.form:fields>
<!--<Input id="inputCharge" editable="true" placeholder="{i18n>CHARGE}" enabled="true"/>-->
</sap.ui.layout.form:fields>
</sap.ui.layout.form:FormElement><sap.ui.layout.form:FormElement id="element4">
<sap.ui.layout.form:fields>
<Input id="inputMenge" editable="true" placeholder="1" enabled="true" value="1"/>
<!--<Label text="BME" id="BME_lbl" textAlign="Left"/>-->
</sap.ui.layout.form:fields>
<sap.ui.layout.form:fields>
<Input id="input6" placeholder="{i18n>UNIT}" enabled="false" fieldWidth="20%" value="ST"/>
</sap.ui.layout.form:fields>
</sap.ui.layout.form:FormElement>
</sap.ui.layout.form:formElements>
</sap.ui.layout.form:FormContainer>
</f:formContainers>
</f:Form>
Thanks!
<MultiComboBox id="mcbLeave" placeholder="{i18n>choose_leave_type}" selectionFinish="onSelectLeaveType" width="42%">
<items>
<core:Item text="{i18n>leave}" key="LEAVE"/>
<!--<core:Item text="Ziekteverlof" key="ILLNES"/>-->
<core:Item text="{i18n>telework}" key="TELEWORK"/>
<core:Item text="{i18n>education}" key="EDUCATION"/>
<core:Item text="{i18n>bicycle}" key="BICYCLE"/>
<core:Item text="{i18n>travel}" key="TRAVEL"/>
<core:Item text="{i18n>overtime}" key="OVERTIME"/>
</items>
</MultiComboBox>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello!
Thank you very much for your answer. I solved it in the meantime by my own.
View Code:
<sap.ui.layout.form:FormElement id="element3">
<sap.ui.layout.form:fields> <Select width="100%" id="charges" selectedKey="{Charg}">
<items>
<core:Item text="{Charg}" key="{Bundnr}"/>
</items>
</Select>
</sap.ui.layout.form:fields>
</sap.ui.layout.form:FormElement>
Controller:
var itemTemplate = new sap.ui.core.Item({
key : "{Bundnr}",
text : "{Charg}"
});
selectField.setModel(oJSONModel);
selectField.bindAggregation("items","/",itemTemplate);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please add below code to show dropdown. it was not clear though where exactly you want to add Dropdown, just added at last.
Below code you may refer to bind it with JSON Model. Assuming you already have data from oData service or you already have your data in JSON.
//New code starts
var oModelJson = new JSONModel();
oModel.read("/YourDataSet", {
success: function (oData, response) {
var obj = oData.results;
// ojModel1.setData(oData.results);
oModelJson.setData(obj);
//oselCtrl.setModel(oModelJson, "userslist");
oView.setModel(oModelJson, "userslist");
}
});<br>
Please refer for more details:
https://ui5.sap.com/#/entity/sap.m.Select/sample/sap.m.sample.Select
Hope this helps..
Thanks-
Abhishek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.