Reputation: 11
tooltip="Choose Data type" items="{path:'/COLUMNMETADATADATATYPES'}"
value="{formulaData>/CustomKeyDataTypeID}" >
<core:Item key="{path:'DATATYPEID'}" text="{path:'DATATYPEID'}"></core:Item>
</ComboBox>
i have defined my combo box in xml view as shown above which i have to disable
Upvotes: 0
Views: 3977
Reputation: 77
tl.dr; Use sap.m.Select
By using a sap.m.Combobox
you cannot disable text input and selection at the same time by setting its editable property to false
.
Instead you could use the following options:
sap.ui.commons.DropdownBox
- it would provide what you need, but it is in the commons namespace meaning that it is not mobile optimised. What is more, it is also deprecated in favor of ComboBox since version 1.38. It is also not a good idea to mix it with sap.m
controls, see: SAPUI5 deprecated themes and libraries
sap.m.Select
- this is what you need. It only allows a selection from the items by design.
Upvotes: 3
Reputation: 1507
There is no any methods to disable to user Instead of "Combobox" you will go with the "Select" control
Upvotes: 3
Reputation: 53
@Abul: you meant enabled: false ? That works for me
I am creating an array of Comboboxes, each time i press on add-button, where i increase the counter:
var oComboBox_PosA = [];
oComboBox_PosA[COUNTER_Item] = new sap.ui.commons.ComboBox("Combo_PosA"+COUNTER_Item,{
items : [ new sap.ui.core.ListItem({
text : "Combo 1"
}), new sap.ui.core.ListItem({
text : "Combo 2"
}) ],
enabled: false
});
But Jan is right, one could just use a TextField/view or DropdownBox
Upvotes: 1
Reputation: 4920
Euh, a ComboBox is just that, a "combo" of a DropdownBox with an editable Textfield.
If you don't want users to type in data, you don't need the "combo", so why don't you simply use a DropdownBox instead?
Upvotes: 4