禁用组合框SAPUI5中的项目 [英] Disable item inside combo box SAPUI5

查看:34
本文介绍了禁用组合框SAPUI5中的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有2个项目的组合框.

I have a combo box with, let's say, 2 items.

其中一项具有要报告的相关数据,而另一项则没有.

one of the items has relevant data to report, and the other doesn't.

我如何将组合框中的不需要的项目涂成灰色?

How would I grey out the unwanted item in the combo box?

我可以使整个组合框变灰,但是我不确定如何使组合框内的项目变灰(此组合框由ODATA调用填充).

I can grey out the entire combo box, but I'm not sure how to grey out items inside a combo box (this combo box is populated by an ODATA call).

推荐答案

您可以将组合框的项目设置为禁用,如下所示:

You can set the items of the combo box to the disabled as follows:

要禁用组合框列表中的所选项目:

Want to disable the selected item from combo box list:

this.getView().byId("idOfYourComboBox").getSelectedItem().setEnabled(false);

基于列表中各项的索引.

Based on the index of the items in the list.

this.getView().byId("idOfYourComboBox").getItems()[1].setEnabled(false);

此外,您还可以根据以下键执行相同的操作:

Also, you can do the same thing based on the key like:

this.getView().byId("idOfYourComboBox").getItemByKey("keyName")

让我知道这是否有帮助.

Let me know if this helps.

这篇关于禁用组合框SAPUI5中的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆