【发布时间】:2017-04-13 14:14:00
【问题描述】:
我有一个页面为用户提供 5 个带有安全问题的下拉列表。它们是通过本地 DataSource 对象设置的,基本上是一个对象中的 10 个问题。我想将所有 5 个下拉列表绑定到同一个数据源,并且选择了一个问题,将其从数据源中删除,因此您无法为接下来的任何问题选择它。到目前为止,这是我的代码:
var questions =
[{
value: "Your first pet\'s name?"
},
{
value: "Your favorite teacher?"
},
{
value: "The city you were born in?"
},
{
value: "Your mother\'s maiden name?"
},
{
value: "The high school you attended?"
},
{
value: "First name of the first person you kissed?"
},
{
value: "What did you want to be when you grow up?"
},
{
value: "The brand of your first car?"
},
{
value: "Your favorite city?"
}];
var localDataSource = new kendo.data.DataSource({
data: questions
});
var dropdown = $('.dropdownlist');
dropdown.kendoDropDownList({
dataTextField: "value",
dataValueField: "value",
dataSource: localDataSource
});
还有我用来渲染字段的 HTML:
<input class="dropdownlist w250px" name="questions[1][question]" />
每个问题乘以 5。
【问题讨论】:
标签: javascript kendo-ui datasource kendo-dropdown