gpt4 book ai didi

javascript - dijit.form.ComboBox 无法与 dojox.data.JsonRestStore 一起使用

转载 作者:行者123 更新时间:2023-11-28 07:23:27 25 4
gpt4 key购买 nike

我的商店定义如下:

my_store = new dojox.data.JsonRestStore({
target: '/my/rest/url/to/get/data'
});

我定义了 ComboBox 来与该商店一起使用:

myComboBox = new dijit.form.ComboBox({
store: my_store,
searchAttr: "name",
pageSize: 20,
autoComplete: true,
hasDownArrow: false,
highlightMatch: "all",
style: "width: 80%; height: 17px; float: left",
onChange: function () {
// Do something with my tree
},
labelFunc: function (item, store) {
var splits = item.path[0].split("/");
var label = item.name[0] + " ("
+ splits.slice(0, splits.length - 1).join("/") + ")";
return label;
}
}, "searchBox");

但我无法让它工作。 ComboBox 不显示任何内容。但是当我使用 dojo.data.ItemFileReadStore 时它工作正常。

您能提出任何解决方案吗?顺便说一句,我需要使用 JsonRestStore 因为我用它来延迟加载树。

最佳答案

请检查浏览器控制台中的网络选项卡,以验证剩余调用是否正在进行。可能需要完全限定的 url。例如:'http://localhost//my/rest/url/to/get/data '

或者,您可以使用 dojo.xhrGet 返回 Json 结果并从中创建 dojo.data.ItemFileReadStore。当您实际执行 ajax 调用时,这也会加载组合框。

谢谢

关于javascript - dijit.form.ComboBox 无法与 dojox.data.JsonRestStore 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30030973/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com