如何在Vaadin时间选择器中将可编辑性设置为false

huangapple go评论79阅读模式
英文:

How to set editable false in vaadin time picker

问题

在Vaadin时间选择器中,我们可以输入时间,现在我想将其设置为不可编辑,以便用户无法输入。在这里,只能从列表中选择时间。在Vaadin时间选择器中是否有设置不可编辑的方法?

对于Vaadin时间选择器,有几种方法可供使用。我可以看到有设置只读方法和其他方法,但找不到设置不可编辑的方法。

英文:

In vaadin time picker we can type, now i want to set editable false. so that user can't type.
here,only can select time from the list.. has any method for set editable false in vaadin time picker

there are several method for vaadin time picker, i can see set read only method and other's method ,not find set editable false.

答案1

得分: 1

目前还没有官方的Java API支持此功能,甚至在组件中也没有相应的属性,但您可以通过禁用下拉框的输入元素来实现此目标:

timePicker.getElement().executeJs("this.inputElement.setAttribute('disabled', true);");
英文:

There is no official Java API for that at the moment, or even attribute in the component, but you can achieve the goal by disabling the input element of the combobox like this:

timePicker.getElement().executeJs("this.inputElement.setAttribute('disabled', true)");

huangapple
  • 本文由 发表于 2023年8月10日 16:15:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76873824.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定