如何在sapui5中设置组合框下拉列表的高度?
How to set height of combo box drop down list in sapui5?
我需要在 sapui5 的组合框中为下拉列表设置最大高度。我试过以下代码。
#comboBox1-popup.sapMPopover {
max-height: 400px;
}
#comboBox1.sapMPopoverScroll {
max-height: 400px !important;
}
通过 css 我无法为项目中的特定组合框设置高度。当我尝试“sapMPopover”时,它改变了我整个项目中所有组合框的高度。我想为特定的组合框设置最大高度。提前致谢。
因为 max-height 现在可以直接 属性 或从 xml 访问弹出窗口。您需要等到弹出列表初始化后才能从 ComboBox 中获取它并向其添加自定义 class。
在页面控制器中
onAfterRendering: function(){
this.exec(this);
},
exec: function(self){
var oCombo = self.getView().byId("MyComboBox"),
oPopOver = oCombo.getList();
if(oPopOver !== null
&& oPopOver !== undefined){
oPopOver.addStyleClass("test");
}else{
setTimeout(self.exec, 1, self);
}
}
现在可以在css文件中写入
.test {max-height: 100px !important;}
我需要在 sapui5 的组合框中为下拉列表设置最大高度。我试过以下代码。
#comboBox1-popup.sapMPopover {
max-height: 400px;
}
#comboBox1.sapMPopoverScroll {
max-height: 400px !important;
}
通过 css 我无法为项目中的特定组合框设置高度。当我尝试“sapMPopover”时,它改变了我整个项目中所有组合框的高度。我想为特定的组合框设置最大高度。提前致谢。
因为 max-height 现在可以直接 属性 或从 xml 访问弹出窗口。您需要等到弹出列表初始化后才能从 ComboBox 中获取它并向其添加自定义 class。
在页面控制器中
onAfterRendering: function(){
this.exec(this);
},
exec: function(self){
var oCombo = self.getView().byId("MyComboBox"),
oPopOver = oCombo.getList();
if(oPopOver !== null
&& oPopOver !== undefined){
oPopOver.addStyleClass("test");
}else{
setTimeout(self.exec, 1, self);
}
}
现在可以在css文件中写入
.test {max-height: 100px !important;}