简体   繁体   English

如何禁用“dijit.form.FilteringSelect”小部件?

[英]How to disable a “dijit.form.FilteringSelect” widget?

I cannot find a way to disable the dijit.form.FilteringSelect widget. 我找不到禁用dijit.form.FilteringSelect小部件的方法。 The requirement makes the css display as none is not an option. 该要求使css显示为none不是一个选项。

Any hint? 任何提示? Thanks in advance. 提前致谢。

Figure it out myself: 自己弄清楚:

dijit.byId('_fromState_id').set('disabled', true);

simply does the job. 干脆完成这项工作。 Change it to false can enable the widget. 将其更改为false可以启用窗口小部件。

Cheers. 干杯。

UPDATE UPDATE

Plus, there is another attribute to the widget called "readOnly" , the difference from it and "disabled" is that : 另外,小部件还有另一个名为"readOnly"属性,与它的区别和"disabled"是:

  1. disabled does not allow any value given to the widget, meaning the widget value is always NULL("") in the form. disabled不允许给窗口小部件赋予任何值,这意味着窗口小部件值在窗体中始终为NULL("") It might be a problem in NotNull situation; 这可能是NotNull情况下的一个问题;

  2. but readOnly allows to preset a value to the widget and make it not editable, and user can still submit the value just only not able to change it. 但是readOnly允许为窗口小部件预设一个值并使其不可编辑,用户仍然可以提交值,只是无法更改它。

sample: 样品:

  dijit.byId("_fromState_id").set("value", "NOTAVAILABLE");
  dijit.byId('_fromState_id').set('readOnly', true);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM