简体   繁体   English

Dojo FilteringSelect-禁用项目

[英]Dojo FilteringSelect - disable an item

Is it possible to disable an item from a FilteringSelect using a store? 是否可以使用商店从FilteringSelect禁用项目?
The documentation shows an example of disabling an item, but only if HTML markup is used, and nothing is mentioned about select widgets using a datastore. 该文档显示了一个禁用项目的示例,但仅在使用HTML标记的情况下,并且没有提及使用数据存储区的选择小部件。
Looking at the source doesn't give any clues either. 从源头看也没有任何线索。
If it matters the version of dojo used is 1.9 如果重要的话,使用的dojo版本是1.9

After viewing at the source code I notice that dijit/form/Select extends from dijit/form/_FormSelectWidget which in fact makes it possible to retrieve and disable options in a select. 在查看源代码之后,我注意到dijit/form/Selectdijit/form/_FormSelectWidget扩展而来的,实际上这使得检索和禁用select中的选项成为可能。

dijit/form/FilteringSelect however does not extend from the same widget but rather from a normal dijit/form/MappedTextBox (because of the typing abilities). 但是dijit/form/FilteringSelect并不从同一个窗口小部件扩展,而是从正常的dijit/form/MappedTextBox扩展(由于键入功能)。 Because of this, I'm quite sure it's impossible to do it out of the box, using a store or not (I wasn't able to get it to work without a store and didn't find such an example at the reference guide). 因此,我非常确定无论是否使用商店都不可能开箱即用(我没有商店就无法使用它,并且在参考指南中找不到这样的示例)。

If you really need such a feature, I would suggest looking at the code of dijit/form/FilteringSelect , dijit/form/Select and dijit/form/_FormSelectWidget and trying to extend from one (ore multiple ones) and implement these features by yourself. 如果您确实需要这种功能,建议您查看一下dijit/form/FilteringSelectdijit/form/Selectdijit/form/_FormSelectWidget并尝试从一个(或多个)扩展并dijit/form/_FormSelectWidget实现这些功能。 The only question I ask myself is that, if this functionality isn't implemented by default, there might be a reason behind it. 我问自己的唯一问题是,如果默认情况下未实现此功能,则可能是其背后的原因。

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

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