【发布时间】:2016-02-08 12:46:16
【问题描述】:
我正在使用 AutoForm 包,包括 Meteor 的 select2 扩展。
aldeed:autoform
aldeed:autoform-select2
autoform-select2 上的文档告诉我,我可以像这样设置 use select2Options:
{{> afQuickField name='finalReviewerComments'select2Options=select2Options}}
我的架构:
finalReviewerComments: {
type: String,
max: 20,
autoform: {
options: [
{label: "Good", value: 0},
{label: "9: Grammar/spelling/formatting/readability", value: 9},
{label: "8: Not a finding", value: 8},
{label: "7: Information missing", value: 7},
{label: "6: Repeated/combined finding", value: 6},
{label: "5: FAQ requirements", value: 5},
{label: "4: Multiple findings in one", value: 4},
{label: "3: Context missing", value: 3},
{label: "2: Country/page number error", value: 2},
{label: "1: Misinterpretation", value: 1}
],
type: "select2"
},
optional: true
}
我尝试在 autoform 中将其添加到我的架构中:
afFieldInput: {
select2Options: {
placeholder: "Imaginary text here"
}
}
并使用文档中指出的辅助函数 select2Options:
Template.finalReview.helpers({
select2Options: function () {
return {placeholder: "Final Review Comments"};
}
});
这两个选项都不起作用。我怎样才能让它工作?表单呈现时我想要一个空的 select2 输入框。
编辑:澄清一下:{allowclear: true} 也不起作用。
【问题讨论】:
-
您能尝试使用
afFieldInput代替afQuickField元素吗?
标签: javascript meteor jquery-select2 meteor-autoform