store.fetch不是函数(dojo)

时间:2012-03-21 14:28:04

标签: javascript dojo dijit.form

我正在尝试实现filteringselect(dojo)我试图从内存存储中获取值。我能够在我的页面上看到filteringselect,但它没有返回任何内容,而且firebug一直说 store.fetch is not a function

以下是代码段。有线索吗?

store1 = new dojo.store.Memory({data: fArr});
   var f1 = new dijit.form.FilteringSelect({
                    name: "Ans",
                    searchAttr: "No",
                    placeHolder: "Select",
                    store: store1
                }, "filteringSelect");
        f1 .placeAt("s1");

问候。

2 个答案:

答案 0 :(得分:5)

dojo.store.Memory使用新的商店API,而FilteringSelect正尝试使用旧的API(获取)访问它。

您可以尝试使用dojo.store.DataStore适配器,以便将新的样式存储传递给需要旧接口的东西。

new dijit.form.FilteringSelect({
    //...
    store: dojo.store.DataStore(store1)
});

答案 1 :(得分:1)

商店:dojo.data.ObjectStore({ objectStore:store1})这对我有用..