cancel
Showing results for 
Search instead for 
Did you mean: 

Class is unknown setting SAPUI5

buch
Employee
Employee
0 Kudos

Hey everyone,


I am trying to set class in the comboBox

let oComboOperator = new sap.m.ComboBox(this.getView().createId("comboAddOperator" + this.countFilter), {
                    items: {
                        path: operatorName + ">/",
                        sorter: { path: "operator" },
                        template: new sap.ui.core.Item({
                            key: "{" + operatorName + ">key}",
                            text: "{" + operatorName + ">operator}"
                        })
                    },
                    placeholder: "Enter Operator",
                    class: "sapUiSmallMarginEnd"
                });


However, it does not work. The error is

Assertion failed: ManagedObject.apply: encountered unknown setting 'class' for class 'sap.m.ComboBox' (value:'sapUiSmallMarginEnd')

Anyone knows what I did wrong here?

Thanks in advance

Buch

View Entire Topic
gippy
Participant

Hi buch,

class is a reserved keyword in JS. That's why it is giving an error on it. To apply CSS class in SAPUI5, please use addStyleClass method in the control.

let oComboOperator =newsap.m.ComboBox(this.getView().createId("comboAddOperator" + this.countFilter), {
                    items:{
                        path: operatorName +">/",
                        sorter:{ path:"operator" },
                        template:newsap.ui.core.Item({key:"{" + operatorName + ">key}",text:"{" + operatorName + ">operator}"})},
                    placeholder:"Enter Operator"}).addStyleClass("sapUiSmallMarginEnd");
buch
Employee
Employee
0 Kudos

thank you this works as I wanted

Kind Regards,

Buch