如果您的商店 FilteringSelect searchAttr 与您的数据存储“标识符”中的相同,您将在下拉列表中看到一组唯一的值。
例如,如果您将标识符从 myStore 更改为“color”,您的下拉菜单将仅显示红色、橙色和黄色,而不是重复的黄色。
这就是为什么,如果您在 FilteringSelect 中使用此商店定义并将 searchAttr 设置为“Fruit”,您将只看到两个值;橙子和苹果
var myStore = new dojo.data.ItemFileReadStore({
url: 'data.json'
});
<div dojoType="dijit.form.ComboBox" store="myStore" id="fsKeywords" searchAttr="name" onChange="filterGrid()"></div>
data.json 文件:
{
identifier: "Fruit",
label: "Name",
items: [
{
"Fruit":"orange",
"color":"red",
"size":"small"
},
{
"Fruit":"orange",
"color":"orange",
"size":"big"
},
{
"Fruit":"orange",
"color":"yellow",
"size":"small"
},
{
"Fruit":"apple",
"color":"yellow",
"size":"small"
}
]}
我想知道是否有办法以编程方式更改商店标识符