![](/img/trans.png)
[英]How to get the “value” of a FilteringSelect <select> in dojo?
[英]How to get the value of a dojo FilteringSelect?
我正在使用如下的dojo filterSlect:
new dijit.form.FilteringSelect({
name : "category",
title : "Category:",
placeHolder : "Select a category",
store : new Memory({data : [],idProperty : "name"}),
maxHeight : "250",
intermediateChanges : true,
searchAttr : "name",
onChange : lang.hitch(this, this._submitCategory)
});
我正在创建添加ID为id=1
, value=abc
等ID的值的内存存储。
此分配内存存储来存储的属性filteringSelect
。 我已将此小部件添加到表单中,并调用form.watch
以获取OnChange
值。
this._formContentForASAP = new Form({
id : 'asap24x',
name : "ASAP 24x",
style : "height:30px;width:250px;"
});
this._formContentForASAP.resize();
this._formContentForASAP.placeAt(this._asapcontentpane);
this._formContentForASAP.watch('value', lang.hitch(this, this._handleASAPFormChanges));
有了这个,我只能在onChange
之后获得ID。
_handleASAPFormChanges : function(prop, oldval, newval) {
// OnChange im able to get only the Id's
}
我如何获取值呢?
如果要在输入字段中输入文本,请使用以下命令:
dijit.registry.byId(ElementID).textbox.value;
如果您想要与所选选项相对应的值,请使用以下命令:
dijit.registry.byId(ElementID).value;
其中ElementID是提供给FilteringSelect元素的ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.