on 08-19-2015 6:33 AM
Hi I am new to UI5 I have written below code to display a Combo Box with List Items containing Icon and Text.
<ComboBox width="25em">
<sap.ui.core:ListItem icon="sap-icon://employee" text="{i18n>Person}" key="1"/>
<sap.ui.core:ListItem icon="sap-icon://factory" text="{i18n>Organization}" key="2"/>
</ComboBox>
I am getting text but not Icon as shown below, some one guide me if i am making any mistake.
yes, i Check code and icon cannot be supported.
so, sap.m.select
surely it will work.
with in that use like this
icon : sap.ui.core.URI (default: )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi M,
As Santhosh said currently it's not possible to display "image" or "icon" in dropdown. You can only display "text".
May be in future we will have this functionality.
Thanks and Regards,
Abhijeet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Can you try with below option
function makeIconItems() {
return [
new sap.ui.core.ListItem({text:'CheckBox', icon:'images/ctrls/checkbox-icon.png'}),
new sap.ui.core.ListItem({text:'ComboBox', icon:'images/ctrls/combobox-icon.png'}),
new sap.ui.core.ListItem({text:'DatePicker', icon:'images/ctrls/datepicker-icon.png'}),
new sap.ui.core.ListItem({text:'DropdownBox', icon:'images/ctrls/dropdownbox-icon.png'}),
new sap.ui.core.ListItem({text:'RadioButton', icon:'images/ctrls/radiobutton-icon.png'}),
new sap.ui.core.ListItem({text:'RadioButtonGroup', icon:'images/ctrls/radiobuttongroup-icon.png'}),
new sap.ui.core.ListItem({text:'RatingIndicator', icon:'images/ctrls/ratingindicator-icon.png'}),
new sap.ui.core.ListItem({text:'Slider', icon:'images/ctrls/slider-icon.png'}),
new sap.ui.core.ListItem({text:'TextArea', icon:'images/ctrls/textarea-icon.png'}),
new sap.ui.core.ListItem({text:'TextField', icon:'images/ctrls/textfield-icon.png'}),
new sap.ui.core.ListItem({text:'PasswordField', icon:'images/ctrls/passwordfield-icon.png'}),
];
}
var oIconListBox1 = new sap.ui.commons.ListBox({
displayIcons:true,
items : makeIconItems()
}).placeAt("sample3");
var oIconListBox2 = new sap.ui.commons.ListBox({
displayIcons:true,
items : makeIconItems(),
visibleItems : 5
}).placeAt("sample3");
var oIconListBox3 = new sap.ui.commons.ListBox({
displayIcons:true,
items : makeIconItems(),
height: "200px"
}).placeAt("sample3");
Thanks
Prasad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Inn Combobox what ever mentioned in text only displayed. so for "text" you can't add icon.
but using getIcon() method you can get selected item icon. But in combobox you can't show a icon as text.
http://jsfiddle.net/SanthoshGowda/ttjf3mge/6/
If you change, oItemTemplate1.bindProperty("text", "device"); it will shows the text but if you change icon, it won't.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
see ComboBox API-https://sapui5.hana.ondemand.com/docs/api/symbols/sap.m.ComboBox.html
for combobox you can add - key,text,additinalText. text and additionalText will be visible in combobox. But these 2 are text type so if you add icon to list also it will not visible here.
Hi,
Why you not use js combo box instead of XML.
TRY this
https://openui5.hana.ondemand.com/test-resources/sap/ui/commons/demokit/ComboBox.html#__2
With Regars,
siva.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Have you checked with standard list item.
Please refer the link.
You can also see the sample code there.
Thanks,
Sathish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Satish,
I can see standard list item doesnt have option to set "Keys" for items.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.