ItemFileReadStore集合如下:
{ id: "id",
label: "id",
items: [
{ number: "123", keyword: "aaa" },
{ number: "123", keyword: "bbb" },
{ number: "123", keyword: "ccc" },
{ number: "456", keyword: "ddd" },
{ number: "456", keyword: "eee" },
{ number: "456", keyword: "fff" },
{ number: "456", keyword: "ggg" },
{ number: "456", keyword: "hhh" }
]
}
<input jsid="select" dojoType="dijit.form.ComboBox" store="somestore"
searchAttr="number"/>
出来的combobox中,number域并不会去重,123出现3次, 456出现5次,
怎样,才能选出“SELECT DISTINCT(*)”的效果呢?
请教大牛。
--
FROM 202.108.130.*
首先DataStore本身没有类似SQL的查询功能。参考:
http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/data-retrieval-dojo-data/selecting-items
其实query属性只能完成类似"filter"的功能,如果你需要高级的distinct, group, order by,都需要你给fetch函数提供额外的参数,如:
itemStore .fetch({
queryOptions: {ignoreCase: true},
onItem: checkDuplicate,
onComplete: done
});
checkDuplicate = function(item, request){
// ...
}
详见:
http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/data-retrieval-dojo-data/asynchronous-loading
【 在 PatoMilan (拍拖米兰 | 越长大越孤单) 的大作中提到: 】
: ItemFileReadStore集合如下:
: { id: "id",
: label: "id",
: ...................
--
FROM 202.108.130.*