- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我为 EPiServer 开发了一个 dijit 小部件。在小部件中,有一个 FilteringSElect 可以从 REST 存储中获取数据。填充 FilteringSelect 的值是数字 Id 和文本值。
EPiServer保存值时,保存的是数值(Id)。
我的整个小部件看起来像这样:
{
return declare("communityuser.editors.CommunityUserSelector", [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin, _CssStateMixin, _ValueRequiredMixin], {
templateString: "<div class=\"dijitInline\">\
<div data-dojo-attach-point=\"stateNode, tooltipNode\">\
<div data-dojo-attach-point=\"inputWidget\" data-dojo-type=\"dijit.form.FilteringSelect\" style=\"width: 300px\"></div><span style=\"padding-left:10px;\"><a href=\"#\" data-dojo-attach-point=\"resetLink\">Reset</a></span>\
</div>\
</div>",
intermediateChanges: false,
value: null,
store: null,
onChange: function (value) {
// Event
},
postCreate: function () {
// call base implementation
this.inherited(arguments);
// Init textarea and bind event
this.inputWidget.set("intermediateChanges", this.intermediateChanges);
//set whether the internal required property is true
this.inputWidget.set('required', false);
//get a reference to the CommunityUserStore
var registry = dependency.resolve("epi.storeregistry");
this.store = this.store || registry.get("customquery");
//set the store for the FilteringSelect
this.inputWidget.set("store", this.store);
//connect the onChange event for the FilteringSelect
this.connect(this.inputWidget, "onChange", this._onInputWidgetChanged);
//connect the onclick event for the Reset Link
this.connect(this.resetLink, "onclick", this._onResetClicked);
},
isValid: function () {
// summary:
// Check if widget's value is valid.
// tags:
// protected, override
return true;
},
// Setter for value property
_setValueAttr: function (value) {
if (!value) {
return;
}
//set the value of the FilteringSelect and the value of the parent control
this.inputWidget.set("value", value.userId);
this._set("value", this._serializeUser(value));
},
// Event handler for the changed event of the input widget
_onInputWidgetChanged: function (value) {
this._updateValue(value);
},
//Event handler when the Selection in the FilteringSelect is changed
_updateValue: function (value) {
//check whether the initial value matches the new value i.e. the value after the selection has changed
if (this._started && epi.areEqual(this.value, this._serializeUser(value))) {
return;
}
//create an object representation of the value
var formattedValue = (!value) ? {} : this._serializeUser(value);
this._set("value", formattedValue);
this.onChange(formattedValue);
},
_onResetClicked: function (event) {
event.preventDefault();
this.inputWidget.reset();
},
_serializeUser: function(userId) {
return ({userId: userId });
},
});
最佳答案
对于 FilteringSelect,您可以设置三个属性:“searchAttr”、“labelAttr”和“value”。您可以将“searchAttr”设置为可以进行过滤搜索的数据中的属性名称,将“labelAttr”设置为将显示在 UI 中的数据的属性名称,并将“值”设置为您当前选择的 ID。喜欢
var selector = new FilteringSelect({
searchAttr:"label", //label is property name in your data
labelAttr:"label",
required:false,
value:"selectedId",
store: dojo.store.Observable(new dojo.store.Memory({
idProperty:"name", //if your store key property is not "id", instead of it is "name", you can set like this
data: []
}))
}, dojo.create("span", null, yourDiv)
);
selector.get('value);
selector.set('value', yourValue);
关于dojo - 使用保存的值设置 dijit FilteringSelect 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19187157/
我想在设置 displayValue 后更新 FilteringSelect 中的下拉列表。我知道 FilteringSelect 在设置 displayValue 后从结果中选择了第一个元素,但是当
以下代码适用于文本框,我可以用自己的代码覆盖默认验证器函数并强制它返回 false,使输入无效。但是,这对 FilteringSelect 输入根本不起作用。以下代码始终返回 true - 事实上它从
我有一个典型的 FilteringSelect,当我输入它时它就可以工作,并且我可以从框中检索值,这很好。但是,我正在尝试确定是否可以访问它返回的项目列表。 例如,如果我的商店中有以下商品: appl
我有一个选择字段,其中我的选项值超过大约 250 个字符,这就是用户无法读取选择框中的值的原因。 有什么方法可以使选择成为水平滚动,或者我可以换行文本。 最佳答案 您可以使用 style 属性指定框的
在你问之前,在这种情况下,多重选择对于用户来说并不是很直观。 我有一个对象,其中一个数组作为“items”的值,该对象在页面上的 var 语句中提供。我还有一个函数可以生成并放置 dijit.form
我刚刚开始尝试将 Dojo 与 ESRI ArcGIS Server 一起使用。我尝试了一些教程,但在使用 Dojo FilteringSelect Dijit 时遇到了问题。 我的代码的相关部分:
我使用 dojo.form.FilteringSelect 作为类似 google 的建议器。根据输入的字符串,我通过 AJAX 获取值列表并将它们放入小部件的存储中。此过程在每次 keyUp 之后启
我正在尝试修改 Dojo FilteringSelect 以禁止在其中输入内容。我知道我可以轻松做到 postCreate: function() { this.inherited(arg
我为 EPiServer 开发了一个 dijit 小部件。在小部件中,有一个 FilteringSElect 可以从 REST 存储中获取数据。填充 FilteringSelect 的值是数字 Id
dijit.form.FilteringSelect 接近我需要的。我已经尝试了很多方法来做我想做的事,但作为一个 dijit 初学者,我永远不知道我是否朝着正确的方向前进。 当我开始在 Filter
我在使 dijit/form/FilteringSelect 小部件自行运行时遇到问题。我怀疑我的选项组合刚刚好,但我似乎无法找到正确的模式。 我的数据源是一个书名列表,我希望用户能够通过下拉菜单并选
我正在使用 dojo 的相同代码 documentation 刚刚下载的代码工作正常,但我的项目没有触发 onchange 事件。 我已经通过触发 onblur onBlur: function(){
我有一个从 创建的 DoJo FilteringSelect . 如何动态禁用一个(未选中的)选项? 谢谢 UPD:当 FilteringSelect 由 PARSE 创建时,是否可以删除此元素?
我尝试使用以下函数从 dijit.form.filteringselect 中删除所有选项并向 dijit.form.filteringselect 添加一个选项。但是,我收到一个错误:没有方法 ge
我有一个 dijit.form.FilteringSelect 组件,我想动态更改选项。但是我从 dijit.form.FilteringSelect 及其商店属性中获得了商店;商店中没有 sette
下面是填充了用户数据的 filteringSelect 示例。我的目标是对显示的值执行通配符匹配。例如,如果用户键入“son”,则下拉匹配项将是“homer simpSON”和“carl calSON
我正在使用由 dojox.data.QueryReadStore 支持的 dijit.form.FilteringSelect 以允许用户选择区域(考虑“自动完成” “机制)。在用户输入的每个字符上,
我在 Zend 表单上一起使用了 dojo FilteringSelect 元素,但我无法让它按我的意愿工作。我有一个包含三个字段的商店 id , label , name .标签将用于下拉菜单,应为
我需要帮助从 FilteringSelect 中删除所有选项。 select的html代码: Izberi... dobiVseKat
我有 Dijit.form.FilteringSelect,它从下拉列表的 Web 服务内容动态加载。 我想预选第一个元素。我该怎么做? 最佳答案 这取决于您的实现。 如果您首先加载数据,然后创建 d
我是一名优秀的程序员,十分优秀!